Arkady's morning seemed to be straight of his nightmare. He overslept through the whole morning and, still half-asleep, got into the tram that arrived the first. Some time after, leaving the tram, he realized that he was not sure about the line number of the tram he was in.

During his ride, Arkady woke up several times and each time he saw the tram stopping at some stop. For each stop he knows which lines of tram stop there. Given this information, can you help Arkady determine what are the possible lines of the tram he was in?


-----Input-----

The first line contains a single integer $n$ ($2 \le n \le 100$) — the number of stops Arkady saw.

The next $n$ lines describe the stops. Each of them starts with a single integer $r$ ($1 \le r \le 100$) — the number of tram lines that stop there. $r$ distinct integers follow, each one between $1$ and $100$, inclusive, — the line numbers. They can be in arbitrary order.

It is guaranteed that Arkady's information is consistent, i.e. there is at least one tram line that Arkady could take.


-----Output-----

Print all tram lines that Arkady could be in, in arbitrary order.


-----Examples-----
Input
3
3 1 4 6
2 1 4
5 10 5 6 4 1

Output
1 4 

Input
5
1 1
10 10 9 8 7 100 5 4 3 99 1
5 1 2 3 4 5
5 4 1 3 2 5
4 10 1 5 3

Output
1 



-----Note-----

Consider the first example. Arkady woke up three times. The first time he saw a stop with lines $1$, $4$, $6$. The second time he saw a stop with lines $1$, $4$. The third time he saw a stop with lines $10$, $5$, $6$, $4$ and $1$. He can be in a tram of one of two lines: $1$ or $4$.

Difficulty: EASY

Solutions:
import math

def main():
	n = int(input())
	tab = []
	for x in range(n):
		i = list(map(int, input().split()))
		i.pop(0)
		tab.append(i)
	for x in range(1, 101):
		inc = 0
		for y in range(n):
			if x in tab[y]:
				inc += 1
		if inc == n:
			print(x, end=' ')
	print()
main()


from sys import stdin, stdout
from math import sin, tan, cos, pi, atan2, sqrt, acos, atan, factorial
n = int(stdin.readline())
used = [0 for i in range(101)]
for i in range(n):
	for v in map(int, stdin.readline().split()[1:]):
		used[v] += 1
for i in range(1, 101):
	if used[i] == n:
		stdout.write(str(i) + ' ')


n = int(input())
s = [0] * 102
for i in range(n):
	a = list(map(int, input().split()))
	for j in range(1, a[0] + 1):
		s[a[j]] += 1
for i in range(101):
	if s[i] == n:
		print(i, end=' ')


n = int(input())
cnt = [0] * 100
for _ in range(n):
	first = True
	for i in list(map(int, input().split(' '))):
		if first:
			first = False
		else:
			cnt[i - 1] = cnt[i - 1] + 1
mx = max(cnt)
res = []
for i in range(len(cnt)):
	if mx == cnt[i]:
		res.append(i + 1)
print(*res)


n = int(input())
tram = [0 for i in range(102)]
for i in range(n):
	arr = list(map(int, input().split()))
	k = arr[0]
	for j in range(1, len(arr)):
		tram[arr[j]] += 1
for i in range(102):
	if tram[i] == n:
		print(i, end=' ')


x = int(input())
maybe = list(map(int, input().split()))
maybe = maybe[1:]
maybe.sort()
listik1 = []
for i in range(x - 1):
	listik1 = list(map(int, input().split()))
	takeit = listik1[0]
	listik1 = listik1[1:]
	listik1.sort()
	j = 0
	while j < len(maybe):
		if maybe[j] not in listik1:
			maybe.remove(maybe[j])
		else:
			j += 1
	if len(maybe) == 1:
		break
print(*maybe)


from math import *
from cmath import *
from itertools import *
from decimal import *
from fractions import *
from sys import *
from types import CodeType, new_class
n = int(input())
d = [0] * 100000
for x in range(n):
	a = input().split()
	for y in a[1:]:
		d[int(y)] += 1
for x in range(10000):
	if d[x] == n:
		print(x, end=' ')


t = int(input())
arr = []
for i in range(t):
	arr2 = []
	for j in range(101):
		arr2.append(0)
	arr.append(arr2)
for i in range(t):
	arr3 = [int(x) for x in input().split()]
	for j in range(1, len(arr3)):
		arr[i][arr3[j]] = 1
for j in range(101):
	co = 0
	for i in range(t):
		if arr[i][j] == 1:
			co += 1
	if co == t:
		print(j, end=' ')


n = int(input())
ai = [1] * 101
ai[0] = 0
for i in range(n):
	ai2 = list(map(int, input().split()))
	ai3 = [0] * 101
	for i in range(1, ai2[0] + 1):
		ai3[ai2[i]] = 1
	for i in range(101):
		ai[i] = min(ai[i], ai3[i])
for i in range(101):
	if ai[i] == 1:
		print(i, end=' ')


n = int(input())
ls = []
for i in range(n):
	arr = [int(j) for j in input().split()]
	for j in range(1, len(arr)):
		ls.append(arr[j])
for j in range(1, 101):
	if ls.count(j) == n:
		print(j, end=' ')


lines = [0 for x in range(101)]
stops = int(input())
for rpt in range(stops):
	stop = [int(x) for x in input().split()]
	for i in range(1, stop[0] + 1):
		lines[stop[i]] += 1
res = ''
for i in range(101):
	if lines[i] == stops:
		res = res + str(i) + ' '
print(res)


n = int(input())
c = [0] * 200
for i in range(n):
	a = list(map(int, input().split()))
	for i in range(1, len(a)):
		c[a[i]] += 1
for i in range(len(c)):
	if c[i] == n:
		print(i, end=' ')


def read_tokens():
	return input().strip().split(' ')

def read_ints():
	return [int(s) for s in read_tokens()]
T = int(input())
d = [0] * 101
for test in range(T):
	arr = read_ints()
	for i in range(1, len(arr)):
		el = arr[i]
		if d[el] != 0:
			d[el] += 1
		else:
			d[el] = 1
for (k, v) in enumerate(d):
	if v == T:
		print(k, end=' ')


from bisect import bisect_right as br
from bisect import bisect_left as bl
from collections import defaultdict
from itertools import combinations
import sys
import math
MAX = sys.maxsize
MAXN = 10 ** 5 + 10
MOD = 10 ** 9 + 7

def isprime(n):
	n = abs(int(n))
	if n < 2:
		return False
	if n == 2:
		return True
	if not n & 1:
		return False
	for x in range(3, int(n ** 0.5) + 1, 2):
		if n % x == 0:
			return False
	return True

def mhd(a, b, x, y):
	return abs(a - x) + abs(b - y)

def numIN():
	return list(map(int, sys.stdin.readline().strip().split()))

def charIN():
	return sys.stdin.readline().strip().split()
n = int(input())
x = [0] * 1000
for _ in range(n):
	l = list(numIN())
	for i in l[1:]:
		x[i] += 1
z = []
for i in range(1000):
	if x[i] == n:
		z.append(str(i))
print(' '.join(z))


def ans(arr):
	i = 1
	a = arr[0]
	while i < n:
		b = arr[i]
		a = a.intersection(b)
		i += 1
	return sorted(list(a))
n = int(input())
temp = []
for _ in range(n):
	r = list(map(int, input().strip().split()))
	temp.append(set(r[1:]))
print(*ans(temp))


n = int(input())
lines = [0 for _ in range(101)]
for _ in range(n):
	(l, *line) = list(map(int, input().strip().split()))
	for v in line:
		lines[v] += 1
maxv = 0
ans = []
for (index, line) in enumerate(lines):
	if line > maxv:
		ans = [index]
		maxv = line
	elif line == maxv:
		ans.append(index)
print(*ans)


n = int(input())
c = [0] * 101
for i in range(0, n):
	r = list(map(int, input().split()))
	for i in range(1, r[0] + 1):
		c[r[i]] += 1
for i in range(0, 101):
	if c[i] == n:
		print(i, end=' ')


a = int(input())
d = []
for i in range(a):
	b = list(map(int, input().split()))
	b.remove(b[0])
	for c in range(len(b)):
		d.append(b[c])
r = max(d)
z = []
e = d[:]
e.sort()
for v in range(r + 1):
	p = e.count(v)
	if p == a:
		z.append(v)
	else:
		continue
zx = list(map(str, z))
q = ' '.join(zx)
print(q)


n = int(input())
main = [True] * 100
for _ in range(n):
	l = [int(x) for x in input().split()]
	l = l[1:]
	d = {}
	for i in l:
		d[i] = 1
	for i in range(100):
		if main[i] == True:
			if d.get(i + 1, False) == False:
				main[i] = False
a = []
for i in range(100):
	if main[i]:
		a.append(i + 1)
for i in a:
	print(i, end=' ')


n = int(input())
q = []
for i in range(n):
	a = list(map(int, input().split()))[1:]
	q.append(a)
r = []
for i in range(1, 101):
	if all((i in a for a in q)):
		r.append(i)
print(' '.join(map(str, r)))


def main():
	from sys import stdin, stdout
	input = stdin.readline
	print = stdout.write
	n = int(input())
	a = [0 for i in range(100)]
	for i in range(n):
		for e in map(int, input().split()[1:]):
			a[e - 1] += 1
	for (i, e) in enumerate(a):
		if e == n:
			print(str(i + 1) + ' ')
main()


n = int(input())
a = [0] * 101
for i in range(n):
	x = list(map(int, input().split(' ')))
	for j in range(1, len(x)):
		a[x[j] - 1] += 1
for i in range(len(a)):
	if a[i] == n:
		print(i + 1, end=' ')


n = int(input())
m = n
l = []
osl = 0
legn = 0
while m > 0:
	a = input()
	b = a.split()
	k = 1
	e = b[0]
	e = int(e)
	while k <= e:
		s = b[k]
		s = int(s)
		l.append(s)
		if s > legn:
			legn = s
		osl = osl + 1
		k = k + 1
	m = m - 1
szam = 0
vegl = []
vegsz = -1
while szam <= legn:
	counter = 0
	ae = 0
	while ae < osl:
		if l[ae] == szam:
			counter = counter + 1
		ae = ae + 1
	if counter == n:
		vegl.append(szam)
		vegsz = vegsz + 1
	szam = szam + 1
for i in vegl:
	print(i, end=' ')


def main_function():
	collector = []
	n = int(input())
	for i in range(n):
		collector += [int(i) for i in input().split(' ')][1:]
	hash_table = [0 for i in range(102)]
	for i in collector:
		hash_table[i] += 1
	output_list = []
	for j in range(len(hash_table)):
		if hash_table[j] == n:
			output_list.append(str(j))
	return ' '.join(output_list)
print(main_function())


n = int(input())
a = [i for i in range(1, 101)]
for i in range(n):
	b = [int(i) for i in input().split()][1:]
	c = []
	for el in a:
		if el in b:
			c.append(el)
	a = c[:]
print(*a)


n = int(input())
l = []
for i in range(n):
	k = list(map(int, input().split()))
	l.append(k[1:])
s = set(l[0])
for i in range(1, n):
	s = s.intersection(l[i])
ll = list(s)
ll.sort()
print(*ll)


stops = int(input())
valid = [0] * 101
for i in range(stops):
	arr = list(map(int, input().split(' ')))
	for u in range(1, len(arr)):
		valid[arr[u]] += 1
sol = []
for i in range(101):
	if valid[i] == stops:
		sol.append(str(i))
print(' '.join(sol))


n = int(input())
freq = [0 for x in range(102)]
for i in range(n):
	l = list(map(int, input().split(' ')))
	for j in range(1, len(l)):
		freq[l[j]] = freq[l[j]] + 1
for x in range(0, 102):
	if freq[x] == n:
		print(x, end=' ')


n = int(input())
mas = [int(0) for i in range(102)]
maxx = 0
cnt = 0
res = []
for i in range(n):
	m = [int(j) for j in input().split()]
	for j in range(1, len(m)):
		mas[m[j]] += 1
		if mas[m[j]] > maxx:
			maxx = mas[m[j]]
for i in range(len(mas)):
	if mas[i] == maxx:
		res.append(i)
print(*res)


n = int(input())
r = set()
for i in range(n):
	a = set(list(map(int, input().split()))[1:])
	if i == 0:
		r = a
	else:
		r &= a
print(' '.join(map(str, sorted(r))))


n = int(input())
v = []
for i in range(n):
	p = list(map(int, input().split()))
	m = p[0]
	if i == 0:
		v = p[1:]
	else:
		v1 = []
		for a in range(1, len(p)):
			for b in range(len(v)):
				if v[b] == p[a]:
					v1.append(v[b])
					break
		v = v1
v = sorted(v)
for i in range(len(v)):
	print(v[i], end=' ')


n = int(input())
res = [0] * 101
for i in range(n):
	nums = list(map(int, input().split()))[1:]
	for num in nums:
		res[num] += 1
for (i, e) in enumerate(res):
	if e == n:
		print(i, end=' ')


n = int(input())
cnt = [0] * 101
for x in range(n):
	lst = [int(y) for y in input().split()]
	for i in range(1, len(lst)):
		cnt[lst[i]] += 1
for x in range(1, 101):
	if cnt[x] == n:
		print(x, end=' ')


n = int(input())
lines = [0 for _ in range(101)]
for _ in range(n):
	veci = list(map(int, input().split()))
	for i in range(1, len(veci)):
		lines[veci[i]] += 1
for i in range(len(lines)):
	if lines[i] == n:
		print(i, end=' ')
print()


n = int(input())
ans = [0] * 110
for i in range(n):
	r = list(map(int, input().split()))
	r[0] = 0
	for j in r:
		ans[j] += 1
for i in range(1, 110):
	if ans[i] == n:
		print(i, end=' ')


from collections import Counter
n = int(input())
last_res = []
for i in range(n):
	temp = list(map(int, input().split()))
	del temp[0]
	for j in temp:
		last_res.append(j)
last_res.sort()
res = Counter(last_res)
for i in res:
	if int(res[i]) == n:
		print(int(i), ' ', sep='', end='')


n = int(input())
r = list(map(int, input().split()))
s = r[1:]
for i in range(n - 1):
	r = list(map(int, input().split()))
	r = r[1:]
	q = len(s)
	t = []
	for j in r:
		if j in s:
			t.append(j)
	s = t
s = sorted(s)
print(' '.join(map(str, s)))


n = int(input())
stops = []
res = [0] * 100
sRes = ''
for i in range(n):
	line = input()
	stops.append(line.split(' '))
for i in stops:
	for j in i[1:]:
		res[int(j) - 1] = res[int(j) - 1] + 1
for i in range(len(res)):
	if res[i] == n:
		sRes = sRes + str(i + 1) + ' '
print(sRes)


n = int(input())
freq = [0] * 101
for i in range(n):
	m = [int(i) for i in input().split()][1:]
	for el in m:
		freq[el] += 1
for i in range(101):
	if freq[i] == n:
		print(i, end=' ')


n = int(input())
b = [0] * 101
for i in range(n):
	x = list(map(int, input().split()))
	for i in range(1, len(x)):
		b[x[i]] += 1
c = []
for i in range(len(b)):
	if b[i] == n:
		c.append(i)
print(*c)


n = int(input())
l = [0 for i in range(100)]
for i in range(n):
	a = list(map(int, input().split()))
	for i in range(a[0]):
		l[a[1 + i] - 1] += 1
for i in range(len(l)):
	if l[i] == n:
		print(i + 1, end=' ')


n = int(input())
x = []
m = []
mi = float('inf')
for i in range(n):
	a = list(map(int, input().split()))
	x.append(sorted(a[1:]))
	m.append(len(a[1:]))
mi = m.index(min(m))
y = x.index(x[mi])
s = []
for j in range(len(x[y])):
	flag = 0
	for i in range(n):
		if x[y][j] not in x[i]:
			flag = 1
	if flag == 0:
		s.append(x[y][j])
print(*s)


n = int(input())
x = list(map(int, input().split()))
x = x[1:x[0] + 1]
lenx = len(x)
for i in range(1, n):
	r = list(map(int, input().split()))
	for j in range(0, lenx):
		if not x[j] in r[1:r[0] + 1]:
			x[j] = -1
x = sorted(x)
for i in range(0, len(x)):
	if x[i] > 0:
		print(x[i], end=' ')


d = dict()
for i in range(1, 101):
	d[i] = 0
n = int(input())
for _ in range(n):
	a = list(map(int, input().split()))
	for i in range(1, len(a)):
		d[a[i]] += 1
for i in range(1, 101):
	if d[i] == n:
		print(i, end=' ')


m = [0 for _ in range(101)]
n = int(input())
for i in range(n):
	x = tuple(map(int, input().split()))
	for j in x[1:]:
		m[j] += 1
for i in range(1, 101):
	if m[i] == n:
		print(i, end=' ')


n = int(input())
b = [0] * 101
for _ in range(n):
	a = list(map(int, input().split()))
	for x in a[1:]:
		b[x] += 1
for (i, x) in enumerate(b):
	if x == n:
		print(i, end=' ')
print()


import math, itertools, fractions, heapq, collections, bisect, sys, queue, copy
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def LS():
	return sys.stdin.readline().split()

def S():
	return input()

def summarizeList(l):
	sl = sorted(l)
	a = sl[0]
	c = 1
	res = []
	for x in sl[1:]:
		if x == a:
			c += 1
		else:
			res.append([a, c])
			a = x
			c = 1
	res.append([a, c])
	return res

def main():
	n = I()
	l = []
	for _ in range(n):
		_l = LI()
		l += _l[1:]
	sl = summarizeList(l)
	ans = []
	for (x, c) in sl:
		if c == n:
			ans.append(x)
	return ' '.join((str(x) for x in ans))
print(main())


n = int(input())
xs = list(map(int, input().split()))[1:]
n -= 1
for _ in range(n):
	ys = list()
	for z in list(map(int, input().split()))[1:]:
		if z in xs:
			ys.append(z)
	xs = ys
xs.sort()
print(' '.join([str(x) for x in xs]))