n=int(input())
lists=[]
maximum=0

for i in range(n):
    lists.append(int(input()))
print(lists)
for i in range(n):
    maximum=0
    for j in range(n):
        if j==i:
            continue
        else:
            maximum=max(maximum,lists[j])

    print(maximum)