
N = int(input())

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

for i in range(N):
    tmp_list = []
    for j in range(N):
        if i != j:
            tmp_list.append(an[j])
    print(max(tmp_list))
