while line = gets
  hit,blow = 0,0
  a = line.split.map(&:to_i)
  b = gets.split.map(&:to_i)
  b.each_with_index do |elem,index|
    if a[index] == b[index]
      hit += 1
    elsif a.include?(elem)
      blow += 1
    end
  end
  puts "#{hit} #{blow}"
end