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

ary.each_with_index do |e, i|
  _ary = ary[0, i] + ary[i+1, 200000]
  ret << _ary.max
end  

ret.each do |e|
  puts e
end               

