# input
N = int(input())
A = []
append = A.append

for i in range(N):
    append(int(input()))

# check
for i in range(N):
    nor_result = [n for j, n in enumerate(A) if j != i]
    if not nor_result:
        continue
    print(max(nor_result))