type set = Set of char * int ;;
let suit_list = ["S"; "H"; "C"; "D"]

let rec  make_set suit num res =
  if num = 0 then res
  else make_set suit (num-1) ((suit, num) :: res ) ;;
  
let rec make_lst = function
    [] -> []
  | first :: rest -> (make_set first 13 []) @ (make_lst rest) ;;

let all_cards = make_lst suit_list ;;

let rec delete a = function
    [] -> []
  | x :: rest -> if a = x then delete a rest
                 else x :: (delete a rest) ;;

let () =
  let n = Scanf.scanf "%d\n" (fun n -> n) in
  let pairs = Array.init n (fun _ -> Scanf.scanf "%s %d\n" (fun s n -> s, n)) in
  Array.fold_left (fun lst a -> delete a lst) all_cards pairs
  |> List.iter (fun (x, y) -> Printf.printf "%s %d\n" x y ) ;;
