from sys import stdin
N = int(stdin.readline().rstrip())
A = [int(stdin.readline().rstrip()) for i in range(N)]
for i in range(N):
  copy_A = A[:i]+A[i+1:]
  copy_A.sort(reverse=True)
  print(copy_A[0])