N = gets()
ary = []
N.to_i.times do |_|
  ary << gets()
end
ret = []
p ary

ary.each do |e|
  _ary = ary.dup
  _ary.delete(e)
  ret << _ary.max
  p ret
end  

ret.each do |e|
  puts e
end               

