# For taking integer inputs.
def inp():
    return(int(input()))


N = inp()
A = []
for i in range(N):
    A.append(inp())

for i in range(N):
    temp = A[i]
    A[i] = 0
    print(max(A))
    A[i] = temp
