# coding: UTF-8
import sys
import copy

numlist = []
for line in sys.stdin.readlines():
  numlist.append(int(line.rstrip()))
N = numlist.pop(0)

for i, num in enumerate(numlist):
  nlist = copy.deepcopy(numlist)
  nlist.pop(i)
  maxN = max(nlist)
  print(maxN)
