arr = Array.new
while lineA = gets and lineB = gets
   a = Array.new
   a << lineA
   a << lineB
   arr << a
end
arr.each do |i|
   a = i[0].split(" ")
   a.map!{|j| j.to_i}
   b = i[1].split(" ")
   b.map!{|j| j.to_i}
   hit = 0
   blow = 0
   0.upto(3) do |j|
      if a[j] == b[j]
         hit += 1
      end
   end
   0.upto(3) do |j|
      0.upto(4) do |k|
         if j == k
            next
         elsif a[j] == b[k]
            blow += 1
         end
      end
   end
   puts "#{hit} #{blow}"
end