open Printf
open Scanf

let id x = x

let print_ans (a, b, c, d) =
  printf "AC x %d\n" a;
  printf "WA x %d\n" b;
  printf "TLE x %d\n" c;
  printf "RE x %d\n" d

let solve n =
  let ss = List.init n (fun _ -> scanf "%s " id) in
  let ht = Hashtbl.create n in
  Hashtbl.replace ht "AC" 0;
  Hashtbl.replace ht "WA" 0;
  Hashtbl.replace ht "TLE" 0;
  Hashtbl.replace ht "RE" 0;
  List.iter (fun s -> let v = Hashtbl.find ht s in Hashtbl.replace ht s (v + 1)) ss;
  (Hashtbl.find ht "AC", Hashtbl.find ht "WA", Hashtbl.find ht "TLE", Hashtbl.find ht "RE")
  

let () =
  scanf "%d " solve |> print_ans
