# 入力                                                                          
N = int(input())

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

for i in range(N):
    target = num_list[:i] + num_list[i+1:]
    print(max(target))
