Common between us
Practice
2.3 (3 votes)
Very Easy
Problem
65% Success 774 Attempts 10 Points 1s Time Limit 256MB Memory 1024 KB Max Code

Janardhan bhaiya has intense crush on N girls :p but he is bored as he develops feelings for new girl on each day. So he wants to find perfect girl before searching perfect girl he wants to know the common characteristics between all of his N crushes.

You are given N rows first element of ith row ( ai ) represents number of characteristics ith crush possess. Next ai integers represents the characteristics id.

You have to print the characteristics id which are present in all of the crushes in ascending order.

Note: characteristics id in row may or may not be distinct.

Input:
First line of input is N.
Next each N lines will contain first integer ai and followed by ai space separated integers each representing characteristics id.
Output:
Print the common characteristics id in all of the rows in ascending order if non of the id's are common then print -1.
Constraints:
1 <= N <= 103
1 <= characterstic id <= 103
1 <= sum of all ai <= 106

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:10
1 votes
Tags:
Very-Easy
Points:10
3 votes
Tags:
Very-Easy
Points:10
1 votes
Tags:
Very-Easy
Editorial

No editorial available for this problem.