import Control.Monad

data Card = Card {  suit :: [Char]
                  , number :: Int
                 }

instance Eq Card where
  x == y = suit x == suit y && number x == number y

cardToStr :: Card -> String
cardToStr (Card s n) = s ++ " " ++ show n ++ "\n"

creationCardByNumbers :: [Card] -> [Char] -> Int -> Int -> [Card]
creationCardByNumbers ec s n nn
  | n > nn = []
  | otherwise = findExistCard [Card s n] ec ++ creationCardByNumbers ec s (n + 1) nn

creationCardBySuits ec [] = []
creationCardBySuits ec (x:xs) = creationCardByNumbers ec x 1 13 ++ creationCardBySuits ec xs

findExistCard :: [Card] -> [Card] -> [Card]
findExistCard c [] = c
findExistCard c (x:xs)
  | c == [x] = []
  | otherwise = findExistCard c xs

enumExCd [] = []
enumExCd (x:xs) = [Card ta tb] ++ enumExCd xs
  where
    ta = words x !! 0
    tb = (read :: String -> Int) $ words x !! 1

ft _ [] = []
ft f (x:xs) = f x ++ ft f xs

main = do
  n <- readLn :: IO Int
  ss <- replicateM n getLine
  let exCd = enumExCd ss
  let suits = ["S","H","C","D"]
  putStr $ ft cardToStr $ creationCardBySuits exCd suits