N = int(input())

a_list = []
for i in range(N):
    a_list.append(int(input()))

c_list = []
for i, a in enumerate(a_list[:]):
    b = a_list.pop(i)
    c_list.append(max(a_list))
    a_list.insert(i, b)

for c in c_list:
    print(c)