n = int(input())
d = []
for i in range(n):
    tmp = int(input())
    d.append(tmp)

for i in range(n):
    if i == 0:
        print(max(d[1:]))
    elif i == n - 1:
        print(max(d[:-1]))
    else:
        print(max(d[i+1:] + d[:i]))
