while as = gets
   as = as.split.map(&:to_i)
   bs = gets.split.map(&:to_i)
   hit,blow = 0,0
   as.each_with_index do|a,i|
        bs.each_with_index do|b,j|
         if a == b
            if i == j
               hit += 1
            else
               blow += 1
            end
         end
      end
   end
   print "%d %d\n" % [hit,blow]
end
