

<?php
$haveCardNum = trim(fgets(STDIN));
$cardCheckList = createTrampCheckList();
 
for ($i = 0; $i < $haveCardNum; $i++) {
    list($mark, $num) = getSpacesByExplodeTrimInput();
    $cardCheckList[$mark][$num] = 'check';
}
 
foreach ($cardCheckList as $key => $value) {
    for ($cardNum = 1; $cardNum <= 13; $cardNum++) {
        if (! isset($cardCheckList[$key][$cardNum])) {
            echo $key.' '.$cardNum, PHP_EOL;
        }
    }
}
 
function getSpacesByExplodeTrimInput()
{
    return explode(' ', trim(fgets(STDIN)));
}
 
function createCardCheckList()
{
    return array(
        "S" => array_fill(1, 13, null),
        "H" => array_fill(1, 13, null),
        "C" => array_fill(1, 13, null),
        "D" => array_fill(1, 13, null)
    );
}