n = int(input()) L = [[] for i in range(n)] for i in range(n): a = list(map(int,input().split())) p = a[0] a = a[1:] for i in range(p): L[i].append(a[i]) ans = [] for i in range(n): for j in L[i]: ans.append(j) for i in ans: print(i,end=" ")