Module: Using set


Problem

5 /10


Guests

Problem

Deniska's most important friend is, of course, Mishka. But besides this, the guys have other friends. Very often all friends go to visit each other. Deniska and Mishka decided to determine which of the friends saw everyone. To do this, Deniska kept records of visiting guests at each friend. 

Input
The first line is a number  N - total number of friends (\(0 < N <= 100\)). Next come N lines, each of the i-th line contains a set of numbers from 0 to N-1 - conditional numbers of friends who visited the i-th friend. Each friend could visit another friend any number of times. Number i is missing in ith line (\(0 <= i < N\)) .

Imprint
Output in one line, in ascending order, the conditional numbers of the friends who have been visited by everyone else. If there are none, then print -1.

 

Examples
# Input Output
1 5
1 2 
0 2 3 2 4 3 0
0 1 3 4 
0 4 2
1 2
1 2
2 3
1
2
0
-1