from collections import * N = int(input()) A = [] ans = [] for i in range(N): A.append(deque(map(int, input().split()))) A[i].popleft() for _ in range(105): for i in range(N): if A[i]: ans.append(A[i].popleft()) print(*ans)