main = do
  n_ <- getLine
  let 
    n = read $ head $ words n_ :: Int
    cards = foldr (++) [] $ (\la -> \lb -> (map (\a -> map (\b -> (a,b)) lb) la)) ['S','H','C','D'] [1..13]
    output ls
      | length ls == 0  = ""
      | otherwise       = ([fst $ head ls]) ++ " " ++ (show $ snd $ head ls) ++ "\n" ++ (output $ tail ls)
    func cards n = 
      if n > 0 
        then do
          line <- getLine
          let 
            suit = head $ head $ words line :: Char
            rank = read $ head $ tail $ words line :: Integer
            remove cards suit rank
              | suit /= (fst $ head cards)  = (head cards) : (remove (tail cards) suit rank)
              | rank /= (snd $ head cards)  = (head cards) : (remove (tail cards) suit rank)
              | otherwise                   = tail cards
            in
              func (remove cards suit rank) (n-1)
        else 
          putStr $ output cards
    in
      func cards n

