gets
a = gets.split.map(&:to_i).sort + [Float::INFINITY]
gets
b = gets.split.map(&:to_i).sort + [Float::INFINITY]

u = []
until a.empty?
  if a[0] < b[0]
    u << a.shift
  elsif a[0] > b[0]
    u << b.shift
  else
    u << a.shift
    b.shift
  end
end
u[0..-2].each {|x| p x }
