n = int(input())
a = []
for i in range(n):
    a.append(int(input()))
max1 = 0
for j in range(n):
    for k in range(n):
        if j == k:
            continue
        else:
            if a[k] > max1:
                max1 = a[k]

    print(max1)
    max1 = 0
