
module IntSet = Set.Make(struct
                          type t = int
                          let compare x y = x - y                                     
                        end)
let _ = 
  try
    while true do
      let a = Scanf.scanf "%d %d %d %d\n" (fun w x y z -> [w; x; y; z])
      and b = Scanf.scanf "%d %d %d %d\n" (fun w x y z -> [w; x; y; z]) in
      let sa = List.fold_left (fun s x -> IntSet.add x s) IntSet.empty a
      and sb = List.fold_left (fun s x -> IntSet.add x s) IntSet.empty b in
      let hitn = List.fold_left (+) 0 @@ List.map2 (fun x y -> if x = y then 1 else 0) a b in
      let blown = (List.length ( IntSet.elements ( IntSet.inter sa sb ))) - hitn in
      Printf.printf "%d %d\n" hitn blown
    done
  with
    End_of_file -> ()