n = gets.chomp.to_i
a = n.times.map { gets.chomp.to_i }
(0..(a.length - 1)).each do |i|
  max = 0
  a.each_with_index do |m, j|
    if i != j then
      max = max < m ? m : max
    end
  end
  puts "#{max}"
end