N = int(input())

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

for i in range(N):
    max = 0
    for j in range(N):
        if j!=i and max < a[j]:
            max = a[j]
    print(max)
        