from collections import deque N = int(input()) ans = [] L = [deque(list(map(int,input().split()))) for i in range(N)] for i in range(N) : L[i].popleft() flg = True while flg : flg = False for i in range(len(L)) : if len(L[i]) : flg = True ans.append(L[i].popleft()) print(*ans)