from collections import deque

n = int(input())
alist = deque()
for i in range(n):
    alist.append(int(input()))



anslist = deque()
for _ in range(n):
    ai = alist.popleft()
    anslist.append(max(alist))
    alist.append(ai)

for i in anslist:
    print(i)
    
    