from collections import deque

num = int(input())

arr = deque([])

for i in range(num):
    arr.append(int(input()))

for i in range(num):
    a = arr.popleft()
    print(max(list(arr)))
    arr.append(a)