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

for i in range(N):
        b = []
        for j in range(N):
                if i == j: continue
                b.append(a[j])
        print(max(b))