using System;

class Program
{
    static void Main()
    {
        int c = int.Parse(Console.ReadLine());
        string[] inStr;
        int num;
        
        string wk = "";
        for (int i = 1; i <= 13; i++) { wk = wk + i.ToString() + " "; }
        
        string s = wk;
        string h = wk;
        string c = wk;
        string d = wk;
        
        for (int i = 0; i < c; i++)
        {
            inStr = Console.ReadLine().Split(' ');
            
                 if (inStr[0] == "S") { s.Replace(inStr[1] + " ", ""); }
            else if (inStr[0] == "H") { h.Replace(inStr[1] + " ", ""); }
            else if (inStr[0] == "C") { c.Replace(inStr[1] + " ", ""); }
            else if (inStr[0] == "D") { d.Replace(inStr[1] + " ", ""); }
        }
        
        //結果を表示
        string result = string.Format("{0} {1} {2} {3}", s.TrimEnd(), h.TrimEnd(), c.TrimEnd(), d.TrimEnd());
        Console.WriteLine(result);
    }
}
