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

tmp_array = []
for i in range(n):
    tmp_array = []
    for m in array_int:
        tmp_array.append(m)
    tmp_array.pop(i)
    max_int   = max(tmp_array)
    print(max_int)
