open Str
let () =
  let n = read_int () in
  let rec loop n t h = match n with
      0 -> Printf.printf "%d %d\n" t h
    | i -> Scanf.scanf "%s %s\n" (fun x y -> if x > y then loop (n-1) (t+3) h
                                             else if x = y then loop (n-1) (t+1) (h+1)
                                             else loop (n-1) t (h+3)
             )
  in loop n 0 0
;;
