N, *d = map(int, open(0).read().split())
for i in range(N):
    max = 0
    for j in range(N):
        if d[j] > max:
            if(i == j):
                continue
            max = d[j]
    print(max)