data = input().split()
N = int(data[0])
A = []
for i in range(N):
    inp = int(input())
    A.append(inp)

for i in range(N):
    tmp = A[i]
    A[i] = 0
    Ao = sorted(A)
    ans = Ao[N-1]
    A[i] = tmp
    print(ans)