import sys
import numpy as np

input = sys.stdin.readline
n = int(input())
s = list(int(input()) for _ in range(n))
i = 0
maxn = 0
s2 = []
for i in range(n):
    s2 = s.copy()
    del s2[i]
    print(np.max(np.array(s2)))
    i += 1
