import sys
sys.setrecursionlimit(10**6)

n = int(input())
readline = sys.stdin.readline
a = [int(input()) for _ in range(n)]

ans = []

for _ in range(n):
    tmp = a.pop(0)
    ans.append(max(a))
    a.append(tmp)

print(*ans)