n = input()
n = int(n)
s = list()
h = list()
c = list()
d = list()
for i in range(n):
    m = input().split()
    a = m[0]
    b = int(m[1])
    if a == "S":
        s.append(b)
    elif a == "H":
        h.append(b)
    elif a == "C":
        c.append(b)
    else:           #a == "D"
        d.append(b)
scount = 1
hcount = 1
ccount = 1
dcount = 1
ss = list()
hh = list()
cc = list()
dd = list()
for i in s:
    if i == scount:
        scount += 1
    else:
        ss.append(i)
        scount += 2
for i in h:
    if i == hcount:
        hcount += 1
    else:
        hh.append(i)
        hcount += 2
for i in c:
    if i == ccount:
        ccount += 1
    else:
        cc.append(i)
        ccount += 2
for i in d:
    if i == dcount:
        dcount += 1
    else:
        dd.append(i)
        dcount += 2
for i in ss:
    print("S",i)
for i in hh:
    print("H",i)
for i in cc:
    print("C",i)
for i in dd:
    print("D",i)

