function main()
  
  N = parse(Int,readline())
  A = zeros(Int,N)
  ans = Int[]
  check = 0
  
  for i in 1:N
    A[i] = parse(Int,readline())
  end
  
  for i in 1:N
    check = A[i]
    A[i] = 0
    push!(ans, maximum(A))
    A[i] = check
  end
  
  println.(ans)
  
end

main()