open Printf
open Scanf
       
module IntSet = Set.Make(struct
                          type t = int
                          let compare x y = x - y
                        end)

let () =
  let rec loop () =
    let a = try scanf "%d %d %d %d\n" (fun w x y z -> [w; x; y; z]) with _ -> [] in
    match a with
      [] -> ()
    | _ -> let b = scanf "%d %d %d %d\n" (fun w x y z -> [w; x; y; z]) in
           let sa = IntSet.of_list a
           and sb = IntSet.of_list 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 = IntSet.cardinal (IntSet.inter sa sb) - hitn in
           printf "%d %d\n" hitn blown;
           loop () in
  loop ()