n = int(input())
a = [0]*(n)
for i in range(n):
    a[i] = int(input())
for i in range(n):
    max = 0
    for j in range(n):
        if j == i:
            continue
        if a[j] > max:
            max = a[j]
    print(max)