from collections import deque n = int(input()) L = [] for _ in range(n): Q = deque(map(int, input().split())) Q.popleft() L.append(Q) ANS = [] while True: cnt = 0 for i in range(n): if L[i]: ANS.append(L[i].popleft()) else: cnt += 1 if cnt == n: break print(*ANS)