a=gets.to_i
b=[]
a.times do
  b << gets.chomp.to_i
end
x = []
cnt = 1
a.times do
  x << cnt
  cnt += 1
end
a.times{|t|
  yy = []
  x.each{|xx|
    yy << b[(xx-1)]  unless (t+1) == xx
  }
  puts yy.max
}