def solve(n: int, a: list):
  for i in range(n):
    aa = [a[j] for j in range(n) if i != j]
    print(max(aa))
  

if __name__ == '__main__':
  n = int(input())
  a = [int(input()) for _ in range(n)]
  solve(n, a)