import sys input=lambda: sys.stdin.readline().rstrip() n=int(input()) PA=[[int(i) for i in input().split()] for _ in range(n)] Ans=[] for i in range(100): for j in range(n): if i+1<=PA[j][0]: Ans.append(PA[j][i+1]) print(*Ans)