N = int(input())
A = []
for _ in range(N):
    A.append(int(input()))

for i in range(N):
    # rem = A[i]
    # A.remove(rem)
    # print(max(A))
    # A.insert(i, rem)
    ans = 0
    for j in range(N):
        if not i == j and ans < A[i]:
            ans = A[j]

    print(ans)

