n = int(input())
a = []
for i in range(n):
  a.append(int(input()))

           
for i in range(0,len(a)):
  ax = a.copy()
  del a[i]
  print(max(a))
  a = ax.copy()
  

  #  if 1+i<=len(a):
#    print('i:' ,i)
#    print(max(a[i],a[i+1]))

        
#print(max(a[0],a[-1]   )   )  