import sys
from collections import deque
n = int(sys.stdin.readline())
A = [int(sys.stdin.readline()) for _ in range(n)]
A = deque(A)
for i in range(n):
    tmp = A.popleft()
    print(max(A))
    A.append(tmp)