n = readline()
n = parse(Int, n)
function get_lines(n)
	an = []
	for i in 1:n	
		elem = readline()
		elem = parse(Int, elem)
		push!(an, elem)
	end
 
	for i in 1:n
		an_tmp = copy(an)
		deleteat!(an_tmp, i)
		res = findmax(an_tmp)
		print(res[1])
		print("\n")
	end
end