N,*as=$<.read.split.map(&:to_i)

as.sort!

if 0 < as[0] * as[-1]
  p "#{as[0]} #{as[-1]}"
  if as[0] < 0
    plus = as[0] - as[-1]
    minus = as[1]
  else
    plus = as[1]
    minus = as[0] - as[-1]
  end
  as = as[2..-2]
else
  plus = as[-1]
  minus = as[0]
  as = as[1..-2]
end

as.each do |a|
  if a < 0
    p "#{plus} #{a}"
    plus -= a
  else
    p "#{minus} #{a}"
    minus -= a
  end
end

p "#{plus} #{minus}"
