let split str delim =
  let rec doit s acc =
    match
      try Some (String.index s delim)
      with _ -> None
    with
    | None -> s :: acc
    | Some i ->
        let s1 = String.sub s 0 i in
        let s2 = String.sub s (i + 1) (String.length s - String.length s1 - 1) in
        doit s2 (s1 :: acc)
  in
  List.rev (doit str [])

let () =
  let n = read_int () in
  let rec doit turn p1 p2 =
    if turn > n then Printf.printf "%d %d\n" p1 p2
    else
      let l = read_line () in
      match split l ' ' with
      | [] | [_] -> exit 1
      | c1 :: c2 :: _ ->
          if c1 = c2 then doit (turn + 1) (p1 + 1) (p2 + 1)
          else if c1 < c2 then doit (turn + 1) p1 (p2 + 3)
          else doit (turn + 1) (p1 + 3) p2
  in
  doit 1 0 0