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