import heapq
N = int(input().strip())
a = [list(map(lambda x: int(x)*(-1), input().split())) for i in range(N)]

for i in range(N):
    tmp=a[:i]+a[i+1:]
    heapq.heapify(tmp)
    ans=heapq.heappop(tmp)[0]*(-1)
    print(ans)