sCard = [0] * 13
hCard = [0] * 13 
cCard = [0] * 13
dCard = [0] * 13

callNum = int(input())

for cardLoop in range(callNum-1):
    symbol, cardNum = input().split()
    cardNum = int(cardNum)
    if symbol == "S":
        sCard[cardNum-1] = cardNum
    elif symbol == "H":
        hCard[cardNum-1] = cardNum
    elif symbol == "C":
        cCard[cardNum-1] = cardNum
    elif symbol == "D":
        dCard[cardNum-1] = cardNum

sLack = 0
hCard = 0
cCard = 0
dCard = 0

for cardLoop in range(13):
    if sCard[cardLoop] == 0:
        sLack = sLack + 1
    elif hCard[cardLoop] == 0:
        hLack = hLack +1
    elif cCard[cardLoop] == 0:
        cLack = cLack +1    
    elif dCard[cardLoop] == 0:
        dLack = dLack +1

print("S " + str(sLack))
print("H " + str(hLack))
print("C " + str(cLack))
print("D " + str(dLack))
