import copy

n = int(input())
l = []
for i in range(n):
    l.append(int(input()))

def delete_list(n,l):
    new_l = l.copy()
    new_l.remove(new_l[n])
    return new_l

for i in range(n):
    print(max(delete_list(i,l)))