et split_int s = Str.split (Str.regexp_string " ") s
                  |> List.map int_of_string;;
let rec read () =
  try let l1 = read_line () |> split_int and
          l2 = read_line () |> split_int in
      let rec loop1 (h, b) = function
          i when i = List.length l1 -> (h, b)
        | i -> let rec loop2 hit blow= function
                   j when j = List.length l2 -> (hit, blow)
                 | j -> if i = j && List.nth l2 j = List.nth l1 i then
                          loop2 (hit+1) blow (j+1)
                        else if i != j && List.nth l2 j = List.nth l1 i then
                          loop2 hit (blow+1) (j+1)
                        else
                          loop2 hit blow (j+1)
               in
               let (hit, blow) = loop2 0 0 0
               in
               loop1 (h+hit, b+blow) (i+1)
      in
      let (h, b) = loop1 (0, 0) 0
      in
      Printf.printf "%d %d\n" h b;read ()
  with End_of_file -> ()
;;

let () = read ();;