import numpy as np
N = int(input())
A_lis = list()
for i in range(N):
    A_lis.append(int(input()))

A_lis = np.array(A_lis)
for i in range(N):
    ind = np.ones(N, dtype=bool)
    ind[i] = False
    print(max(A_lis[ind]))