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

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