module Card_set =
  Set.Make
    (struct
      type t = string * int
      let compare (s0,n0) (s1,n1) = match Pervasives.compare s0 s1 with
        | 0 -> Pervasives.compare n0 n1
        | _ ->
          match s0 with
          | "S" -> -1
          | "H" -> if s1 = "S" then 1 else -1
          | "C" -> if s1 = "D" then -1 else 1
          | _ -> 1
    end)

let () =
  let l = (List.concat (List.map
                          (fun x -> List.map
                              (fun n -> x,n)
                              [1;2;3;4;5;6;7;8;9;10;11;12;13])
                          ["S";"H";"C";"D"])) in
  let set = List.fold_left (fun acc x -> Card_set.add x acc) Card_set.empty l in
  let count = read_int () in
  let rec loop i s =
    if i >= count then s
    else
      let line = read_line () in
      let p = Scanf.sscanf line "%s %d" (fun m n -> m,n) in
      loop (i+1) (Card_set.remove p s)
  in
  Card_set.iter (fun (s,n) -> Printf.printf "%s %d\n" s n) (loop 0 set)