def cc
    n = gets.chomp.to_i#.map{|x| x.to_i}

    a = []
    for i in 1..n
        a.push(gets.chomp.to_i)#.map{|x| x.to_i}
    end

    for i in 0..(n-1)
        b = a.dup
        b.delete_at(i)
        puts b.max
    end
end

cc
