import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np

rr = lambda: str(sys.stdin.buffer.readline().rstrip())
rs = lambda: map(str, sys.stdin.buffer.readline().split())
ri = lambda: int(sys.stdin.buffer.readline())
rm = lambda: map(int, sys.stdin.buffer.readline().split())
rl = lambda: list(map(int, sys.stdin.buffer.readline().split()))

n = ri()
a = [ri() for _ in range(n)]
for i in range(n):
  print(max(max(a[0: i]), max(a[i+1: n])))