
N = int(input())

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

def hoge(tmp,i):
    tmp.pop(i)
    return tmp


for j in range(N):
    tmp_list = []
    bn = an.copy()
    tmp_list = hoge(bn,j)
    print(max(tmp_list))

# print(tmp_list)
# print(max(tmp_list))
