<?php
$haveTrampNum = trim(fgets(STDIN));
$trampCheckList = createTrampCheckList();

for ($i = 0; $i < $haveTrampNum; $i++) {
    list($mark, $num) = getSpacesByExplodeTrimInput();
    $trampCheckList[$mark][$num] = 'check';
}

foreach ($trampCheckList as $key => $value) {
    for ($trampNum = 1; $trampNum <= 13; $i++) {
        if (! isset($trampCheckList[$key][$trampNum])) {
            echo $key.' '.$trampNum, PHP_EOL;
        }
    }
}

function getSpacesByExplodeTrimInput()
{
    return explode(' ', trim(fgets(STDIN)));
}

function createTrampCheckList()
{
    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)
    );
}