N = int(input())
a = []
for i in range(N):
    A = int(input())
    a.append(A)
b = []
for i in range(N):
    for j in range(N):
        if i != j:
            b.append(a[j])
        b = sorted(b)
    print(b[-1])
    b = []