$<.readlines.map {|a| a.split.map(&:to_i)}.each_slice(2) do |a, b|
  a1, b1 = [], []
  hit = 0
  a.each_index do |i|
    if a[i] == b[i]
      hit += 1
    else
      a1 << a[i]
      b1 << b[i]
    end
  end
  blow = a1.size - (a1 - b1).size
  puts "#{hit} #{blow}"
end
