module Main where
--import Debug.Trace
import Data.List
import Data.Maybe
import Data.Ord
import Control.Monad

data Suits = Spades Int| Hearts Int| Clubs Int| Diamonds Int deriving (Eq, Ord)
instance Show Suits where
    show (Spades   r) = "S " ++ show r
    show (Hearts   r) = "H " ++ show r
    show (Clubs    r) = "C " ++ show r
    show (Diamonds r) = "D " ++ show r


solve :: [Suits] -> [String]
solve l = map show ([s r| s<-[Spades,Hearts,Clubs,Diamonds], r<-[1..13]] \\ l)

readLine:: IO [Int]
readLine = fmap (map read . words) getLine

readLines :: Int -> IO [Suits]
readLines 0 = return []
readLines n = readLine >>= (\a -> fmap (a:) (readLines (pred n))) where
    readLine = do 
            [suit, rank] <- fmap words getLine
            return $ select suit (read rank)
    select "S" r = Spades   r
    select "H" r = Hearts   r 
    select "C" r = Clubs    r
    select "D" r = Diamonds r


main :: IO() 
main = do
    [n] <- readLine
    l   <- readLines n
    mapM_ putStrLn (solve l)

