import copy
N = int(input())
lists = [0]*N
ans = []
for i in range(N):
    A = int(input())
    lists[i] = A
i = 0
while 1:
    if i == N:
        break
    tmp = copy.deepcopy(lists[i])
    lists[i] = 0
    print(max(lists))
    lists[i] = tmp
    i += 1
