while line = gets do
  a = line.chomp.split(" ").map(&:to_i)
  b = gets.chomp.split(" ").map(&:to_i)
  hit = 0
  blow = 0
  4.times do |i|
    if a.include?(b[i])
      if a[i] == b[i]
        hit += 1
      else
        blow += 1
      end
    end
  end
  puts "#{hit} #{blow}"
end