{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE OverloadedStrings #-}
import Control.Monad
import Control.Monad.ST
import Control.Monad.Primitive
import Data.Maybe
import Data.Char
import Data.Array
import Data.Array.ST
import Data.STRef
import Data.List
import Data.STRef
import qualified Data.ByteString.Char8 as B
import qualified Data.Vector as V
import qualified Data.Vector.Mutable as MV
import qualified Data.Vector.Unboxed as U
import qualified Data.Vector.Unboxed.Mutable as UM

cardToIndex ["S",n] = (read n) - 1
cardToIndex ["H",n] = 13 + (read n) - 1
cardToIndex ["C",n] = 26 + (read n) - 1
cardToIndex [_  ,n] = 39 + (read n) - 1


main = do
  n <- readLn :: IO Int
  cards <- replicateM n $ fmap (cardToIndex . words) getLine
  cardList <- V.thaw $ V.fromList [(mark ++ show number) | mark <- ["S ","H ","C ","D "], number <- [1..13]]

  forM_ cards $ \card -> do
    MV.write cardList card ""

  forM_ [0..51] $ \i -> do
    b <- MV.read cardList i
    when ( b /= "") $ do
      putStrLn b

