from collections import deque
n = int(input())
a = deque()
for i in range(n):
    tmp = int(input())
    a.append(tmp)
#print(a)
for i in range(n):
    tmp = a.popleft()
    print(max(a))
    a.append(tmp)