import numpy as np
N = int(input())
A = []
for n in range(N):
    A.append(int(input()))
A = np.array(A)
for n in range(N):
    ind_rm = [n]
    ind = np.ones(N, dtype=bool)
    ind[ind_rm] = False
    print(max(A[ind]))