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

ans = []
tmp = 0
cnt = 0

for i in range(n):
    tmp = []
    for m in range(n):
        if i != m:
            tmp.append(l[m])
    ans.append(max(tmp))


for j in range(n):
    print(ans[j])