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

for j in range(n):
    copy_list = a_list.copy()
    del copy_list[j]
    max = 0
    for k in copy_list:
        if k > max:
            max = k
    print(k)