n = int(eval(input()))

full_set=set([x for x in range(1,14)])

cards={"S":[],"H":[],"C":[],"D":[]}

for i in range(n):

    suit,num = input().split()

    cards[suit].append(int(num))

for suit in ["S","H","C","D"]:

    suit_set = set(cards[suit])

    for num in sorted(list(full_set - suit_set)): print((suit,num))
n = int(eval(input()))

cards = [[ s+' '+str(n) for n in range(1,14)] for s in ['S','H','C','D']]

for _ in range(n):

    suit,num = input().split()

    if   suit=='S': cards[0][int(num)-1] = 0

    elif suit=='H': cards[1][int(num)-1] = 0

    elif suit=='C': cards[2][int(num)-1] = 0

    elif suit=='D': cards[3][int(num)-1] = 0

for s in cards:

    for n in s:

        if n!=0: print(n)
n = int(eval(input()))
full_set = set([x for x in range(1, 14)])
cards = {"S": [], "H": [], "C": [], "D": []}
for i in range(n):
    suit, num = input().split()
    cards[suit].append(int(num))
for suit in ["S", "H", "C", "D"]:
    suit_set = set(cards[suit])
    for num in sorted(list(full_set - suit_set)):
        print((suit, num))

n = int(eval(input()))
cards = [[s + " " + str(n) for n in range(1, 14)] for s in ["S", "H", "C", "D"]]
for _ in range(n):
    suit, num = input().split()
    if suit == "S":
        cards[0][int(num) - 1] = 0
    elif suit == "H":
        cards[1][int(num) - 1] = 0
    elif suit == "C":
        cards[2][int(num) - 1] = 0
    elif suit == "D":
        cards[3][int(num) - 1] = 0
for s in cards:
    for n in s:
        if n != 0:
            print(n)

-full_set = set([x for x in range(1, 14)]) -cards = {"S": [], "H": [], "C": [], "D": []} -for i in range(n): +cards = [[s + " " + str(n) for n in range(1, 14)] for s in ["S", "H", "C", "D"]] +for _ in range(n): -    cards[suit].append(int(num)) -for suit in ["S", "H", "C", "D"]: -    suit_set = set(cards[suit]) -    for num in sorted(list(full_set - suit_set)): -        print((suit, num)) +    if suit == "S": +        cards[0][int(num) - 1] = 0 +    elif suit == "H": +        cards[1][int(num) - 1] = 0 +    elif suit == "C": +        cards[2][int(num) - 1] = 0 +    elif suit == "D": +        cards[3][int(num) - 1] = 0 +for s in cards: +    for n in s: +        if n != 0: +            print(n)