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


for d in range(s):
  list_2=list
  x = list_2[0]
  list_2.remove(x)
  print(list_2)
  print(max(list_2))
  list_2.append(x)
  