2.times do
  a = gets.chomp.split.map(&:to_i)
  b = gets.chomp.split.map(&:to_i)

  hit = 0

  4.times do |i|
    hit += 1 if a[i] == b[i]    
  end

  blow = (a & b).length - hit

  puts "#{hit} #{blow}"
end