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

for i in range(n):
    m=0
    for j in range(n):
        if i == j:
            continue
        m=max(m,a[j])
    print m

