Problem:

Finding Missing Cards

  Taro is going to play a card game. However, now he has only n cards, even though there should be 52 cards (he has no Jokers).

The 52 cards include 13 ranks of each of the four suits: spade, heart, club and diamond.

Input

  In the first line, the number of cards n (n ≤ 52) is given.

  In the following n lines, data of the n cards are given. Each card is given by a pair of a character and an integer which represent its suit and rank respectively. A suit is represented by 'S', 'H', 'C' and 'D' for spades, hearts, clubs and diamonds respectively. A rank is represented by an integer from 1 to 13.

Output

  Print the missing cards. The same as the input format, each card should be printed with a character and an integer separated by a space character in a line.
 Arrange the missing cards in the following priorities:

Print cards of spades, hearts, clubs and diamonds in this order.

If the suits are equal, print cards with lower ranks first.

Sample Input

47
S 10
S 11
S 12
S 13
H 1
H 2
S 6
S 7
S 8
S 9
H 6
H 8
H 9
H 10
H 11
H 4
H 5
S 2
S 3
S 4
S 5
H 12
H 13
C 1
C 2
D 1
D 2
D 3
D 4
D 5
D 6
D 7
C 3
C 4
C 5
C 6
C 7
C 8
C 9
C 10
C 11
C 13
D 9
D 10
D 11
D 12
D 13

Sample Output

S 1
H 3
H 7
C 12
D 8

Note

      解説      

	



Sample input:
47
S 10
S 11
S 12
S 13
H 1
H 2
S 6
S 7
S 8
S 9
H 6
H 8
H 9
H 10
H 11
H 4
H 5
S 2
S 3
S 4
S 5
H 12
H 13
C 1
C 2
D 1
D 2
D 3
D 4
D 5
D 6
D 7
C 3
C 4
C 5
C 6
C 7
C 8
C 9
C 10
C 11
C 13
D 9
D 10
D 11
D 12
D 13


Sample output:
S 1
H 3
H 7
C 12
D 8

Submission status: Accepted

Solution code:
n = input()
cards = []
for i in range(n):
	cards.append(raw_input().split())

marks = ['S', 'H', 'C', 'D']
for i in marks:
	for j in range(1, 14):
		if [i, str(j)] not in cards:
			print i, j

Submission status: Accepted

Solution code:
n=int(input())
lst=["1","2","3","4","5","6","7","8","9","10","11","12","13"]
#S_list=lst
#H_list=lst
#C_list=lst
#D_list=lst
S_list=["1","2","3","4","5","6","7","8","9","10","11","12","13"]
H_list=["1","2","3","4","5","6","7","8","9","10","11","12","13"]
C_list=["1","2","3","4","5","6","7","8","9","10","11","12","13"]
D_list=["1","2","3","4","5","6","7","8","9","10","11","12","13"]
for i in range(n):
	Del=map(str,raw_input().split())
	if Del[0]=="S":
		S_list.remove(Del[1])
        elif Del[0]=="H": 
                H_list.remove(Del[1]) 
        elif Del[0]=="C": 
                C_list.remove(Del[1]) 
        elif Del[0]=="D": 
                D_list.remove(Del[1]) 
S=map(int,S_list)
H=map(int,H_list)
C=map(int,C_list)
D=map(int,D_list)
#
for i in range(len(S)):
	print "S "+str(S[i])
for i in range(len(H)):
        print "H "+str(H[i])
for i in range(len(C)):
        print "C "+str(C[i])
for i in range(len(D)):
        print "D "+str(D[i])

Submission status: Accepted

Solution code:
lst = [x+' '+str(y) for x in ['S', 'H', 'C', 'D'] for y in range(1, 14)]
n = int(input())
for i in range(n):
    lst.remove(input())
for x in lst:
    print(x)

Submission status: Accepted

Solution code:
cards = [('{0} {1}'.format(suit, no + 1)) for suit in ['S', 'H', 'C', 'D'] for no in range(13)]

n = int(input())
for i in range(n):
    cards.remove(input())

for card in cards:
    print(card)

Submission status: Accepted

Solution code:
# -*- coding:utf-8 -*-
class Cards:
    trump = [False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,False,]
    def HaveCards(self,num):
        self.trump[num] = True
    def TransCards(self,s,num):
        if(s == 'H'):
            num += 13 
        elif(s == 'C'):
            num +=26  
        elif(s == 'D'):
            num += 39
        return num
    def CheckCards(self,num):
        if(num <= 12):
            return 'S' ,num+1
        elif(num >= 13 and num <= 25):
            return 'H'  ,num-12
        elif(num >= 26 and num <= 38):
            return 'C',num-25
        elif(num >= 39 and num <=51):
            return 'D',num-38
        
n = int(input())
ob = Cards()
for i in range(n):
    s,str_num = input().split()
    number = int(str_num)
    Num=ob.TransCards(s,number-1)
    ob.HaveCards(Num)

for i in range(len(Cards.trump)):
    if Cards.trump[i] == False:
        Str,Num=ob.CheckCards(i)
        print(Str,Num)

Submission status: Accepted

Solution code:
n = int(input())
cs = [ (s,k) for s in ['S', 'H', 'C', 'D'] for k in range(1,14) ]
for _ in range(n):
    s,k = input().split()
    cs.remove((s,int(k)))
for (s, k) in cs:
    print(s, k)

Submission status: Accepted

Solution code:
haveTrumps = [[0 for i in range(13)] for j in range(4)]
allCards = int(input())
for i in range(0, allCards):
    cardType, cardNum = input().split()
    if cardType == "S":
        haveTrumps[0][int(cardNum) - 1] = 1
    elif cardType == "H":
        haveTrumps[1][int(cardNum) - 1] = 1
    elif cardType == "C":
        haveTrumps[2][int(cardNum) - 1] = 1
    elif cardType == "D":
        haveTrumps[3][int(cardNum) - 1] = 1
for i in range(0, 4):
    for j in range(0, 13):
        if haveTrumps[i][j] == 0:
            if i == 0:
                print("S ", end="")
            elif i == 1:
                print("H ", end="")
            elif i == 2:
                print("C ", end="")
            elif i == 3:
                print("D ", end="")
            print("{0}".format(j + 1))

Submission status: Accepted

Solution code:
# 11-Array-Finding_Missing_Cards.py

# ????¶???????????????????????????????
# ???????????±?????¨?????????????????????????????????????????¨????????¨?????????52?????????????????????????????? n ????????????????????????????????????????????????
# ???????????? n ????????????????????\?????¨??????????¶??????????????????????????????????????????°?????????????????????????????????
# ???????????????????????£?????????????????????????????§??????????????????52?????????????????§??????

# 52???????????????????????????????????????????????????????????????????????????????????????????????????????????????
# ???????????????13??????????????????????????????

# Input
# ?????????????????????????????£??????????????????????????° n (n ??? 52)????????????????????????
# ?¶??????? n ????????????????????????????????????????????????????????????
# ??????????????????????????§???????????????????????¨??´??°??§??????
# ????????????????????????????????¨?????????????????????'S'???????????????'H'???????????????'C'???????????????'D'??§??¨?????????????????????
# ??´??°??????????????????????????????(1 ??? 13)?????¨??????????????????

# Output
# ?¶??????????????????????????????????1??????????????????????????????
# ?????????????????\?????¨????§?????????????????????§???????????????????????¨??´??°??§??????
# ???????????????????????????????????\????????¨????????¨????????????

# ????????????????????????????????????????????????????????????????????§???????????????????????????
# ?????????????????´??????????????????????°????????????????????????????
# Sample Input
# 47
# S 10
# S 11
# S 12
# S 13
# H 1
# H 2
# S 6
# S 7
# S 8
# S 9
# H 6
# H 8
# H 9
# H 10
# H 11
# H 4
# H 5
# S 2
# S 3
# S 4
# S 5
# H 12
# H 13
# C 1
# C 2
# D 1
# D 2
# D 3
# D 4
# D 5
# D 6
# D 7
# C 3
# C 4
# C 5
# C 6
# C 7
# C 8
# C 9
# C 10
# C 11
# C 13
# D 9
# D 10
# D 11
# D 12
# D 13
# Sample Output
# S 1
# H 3
# H 7
# C 12
# D 8

pair= []
no_cards= []

hand= int( input() )

for i in range( hand ):
	pair.append( input().split() )

#????????§????¶??????????????????????????????????????????????????????????
for i in ['S', 'H', 'C', 'D']:
	for j in range(13):
		if [i, str(j+1)] not in pair:
			 no_cards.append( [i, str(j+1)] ) 

for i in range( len(no_cards) ):
	print('{0} {1}'.format(no_cards[i][0], no_cards[i][1]))

Submission status: Accepted

Solution code:
S_number = [int(i) for i in range(1,14)]
H_number = [int(i) for i in range(1,14)]
C_number = [int(i) for i in range(1,14)]
D_number = [int(i) for i in range(1,14)]


n = int(input())

for i in range(1,n+1):
    cord = input().split()
    if cord[0] == "S":
        S_number.remove(int(cord[1]))
        #print(cord)
    elif cord[0] == "H":
        H_number.remove(int(cord[1]))
        #print(cord)
    elif cord[0] == "C":
        C_number.remove(int(cord[1]))
        #print(cord)
    elif cord[0] == "D":
        D_number.remove(int(cord[1]))

if len(S_number) != 0:
    for i in range(len(S_number)):
        print("S {0}".format(S_number[i]))
if len(H_number) != 0:
    for i in range(len(H_number)):
        print("H {0}".format(H_number[i]))
if len(C_number) != 0:
    for i in range(len(C_number)):
        print("C {0}".format(C_number[i]))
if len(D_number) != 0:
    for i in range(len(D_number)):
        print("D {0}".format(D_number[i]))

Submission status: Accepted

Solution code:
#???????????????????????????????????????
S_number = [int(i) for i in range(1, 14)]
H_number = [int(i) for i in range(1, 14)]
C_number = [int(i) for i in range(1, 14)]
D_number = [int(i) for i in range(1, 14)]

#?????°?????\???
n = int(input())

#??\???????????????????????¨??????????????????????????????????????????
for i in range(1, n + 1):
    cord = input().split()
    if cord[0] == "S":
        S_number.remove(int(cord[1]))
    elif cord[0] == "H":
        H_number.remove(int(cord[1]))
    elif cord[0] == "C":
        C_number.remove(int(cord[1]))
    elif cord[0] == "D":
        D_number.remove(int(cord[1]))

#?????£????????????????????¨???
if len(S_number) != 0:
    for i in range(len(S_number)):
        print("S {0}".format(S_number[i]))
if len(H_number) != 0:
    for i in range(len(H_number)):
        print("H {0}".format(H_number[i]))
if len(C_number) != 0:
    for i in range(len(C_number)):
        print("C {0}".format(C_number[i]))
if len(D_number) != 0:
    for i in range(len(D_number)):
        print("D {0}".format(D_number[i]))

Submission status: Accepted

Solution code:
n = int(input())
Cards = [[0 for i in range(13)]  for j in range(4)]

for i in range(n):
    Mark,Number = input().split()
    if Mark == "S":
        Cards[0][int(Number) - 1] = 1
    elif Mark == "H":
        Cards[1][int(Number) - 1] = 1
    elif Mark == "C":
        Cards[2][int(Number) - 1] = 1
    elif Mark == "D":
        Cards[3][int(Number) - 1] = 1

for x in range(4):
    for y in range(13):
        if Cards[x][y] == 0:
            if x == 0:
                print("S",y+1)
            elif x == 1:
                print("H",y+1)
            elif x == 2:
                print("C", y + 1)
            elif x == 3:
                print("D", y + 1)

Submission status: Accepted

Solution code:
n = int(input())
cards = [[0 for i in range(13)] for j in range(4)]

for i in range(n):
    Input = input().split()
    if Input[0] == "S":
        cards[0][int(Input[1])-1]= 1
    if Input[0] == "H":
        cards[1][int(Input[1]) - 1] = 1
    if Input[0] == "C":
        cards[2][int(Input[1]) - 1] = 1
    if Input[0] == "D":
        cards[3][int(Input[1]) - 1] = 1

for i in range(4):
    for j in range(13):
        if cards[i][j] == 0:
            if i == 0:
                print("S",j+1)
            if i == 1:
                print("H",j+1)
            if i == 2:
                print("C", j + 1)
            if i == 3:
                print("D", j + 1)

Submission status: Accepted

Solution code:
deck={"S":[0]*13,"H":[0]*13,"C":[0]*13,"D":[0],"D":[0]*13}
n=input()

for i in range(0,n):
	suit, num=raw_input().split()
	deck[suit][int(num)-1]=1

for i in ["S","H","C","D"]:
	for j in range(0,13):
		if (deck[i][j]==0):
			print "%s %d" %(i,j+1)

Submission status: Accepted

Solution code:
n = int(input())
full_set=set([1,2,3,4,5,6,7,8,9,10,11,12,13])
S=[]
H=[]
C=[]
D=[]
for i in range(n):
    suit,num = input().split()
    if   suit=="S": S.append(int(num))
    elif suit=="H": H.append(int(num))
    elif suit=="C": C.append(int(num))
    elif suit=="D": D.append(int(num))
S_set=set(S)
H_set=set(H)
C_set=set(C)
D_set=set(D)
for (suit,suit_set) in zip(["S","H","C","D"],[S_set,H_set,C_set,D_set]):
    for num in sorted(list(full_set - suit_set)): print(suit,num)

Submission status: Accepted

Solution code:
n = int(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)

Submission status: Accepted

Solution code:
n = int(input())
s = [a for a in range(1, 14)]
h = [a for a in range(1, 14)]
c = [a for a in range(1, 14)]
d = [a for a in range(1, 14)]
suits = ['S', 'H', 'C', 'D']
for i in range(n):
  x, y = [z for z in input().split()]
  y = int(y)
  if x == 'S':
    s[y - 1] = 0
  elif x == 'H':
    h[y - 1] = 0
  elif x == 'C':
    c[y - 1] = 0
  else:
    d[y - 1] = 0
data = [s, h, c, d]
for i in range(4):
  for x in data[i]:
    if x != 0:
      print(suits[i], str(x))

Submission status: Accepted

Solution code:
import sys
import math

n = input()

s = [set(), set(), set(), set()]
ch = {0:"S", 1:"H", 2:"C", 3:"D"}

for i in xrange(n) :
    kind, num = raw_input().split()
    num = int(num)

    for j in xrange(4) :
        if (kind == ch[j]) :
            s[j].add(num)
            break

for i in xrange(4) :
    for j in xrange(1, 14) :
        if not(j in s[i]) :
            print ch[i], j

Submission status: Accepted

Solution code:
n = int(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)

Submission status: Accepted

Solution code:
S,H,C,D = set(),set(),set(),set()
W = set([1,2,3,4,5,6,7,8,9,10,11,12,13])
n = int(input())
for i in range(n):
    N = input().split()
    if N[0] == 'S':
        S.add(int(N[1]))
    elif N[0] == 'H':
        H.add(int(N[1]))
    elif N[0] == 'C':
        C.add(int(N[1]))
    elif N[0] == 'D':
        D.add(int(N[1]))
s,h,c,d = [],[],[],[]
st = W - S
while st != set():
  s.append(st.pop())
s.sort()
ht = W - H
ct = W - C
dt = W - D
while ht != set():
  h.append(ht.pop())
h.sort()
while ct != set():
  c.append(ct.pop())
c.sort()
while dt != set():
  d.append(dt.pop())
d.sort()

for i in s:
    print('S {0}'.format(i))
for i in h:
    print('H {0}'.format(i))
for i in c:
    print('C {0}'.format(i))
for i in d:
    print('D {0}'.format(i))

Submission status: Accepted

Solution code:
def create_card():
    return [str(i) for i in range(1,14)]
Card = {
        'S':create_card(),
        'H':create_card(),
        "C":create_card(),
        "D":create_card(),
        }
for i in range(int(input())):
    in_str = input().split()
    Card[in_str[0]].remove(in_str[1])

for s in ['S','H','C','D']:
    while(Card[s]):
        print(s,Card[s].pop(0))

Submission status: Accepted

Solution code:
n = int(input())
cards = ["{0} {1}".format(design, num) for design in ["S", "H", "C", "D"] for num in range(1, 14)]

for _ in range(n):
    cards.remove(input())
    
for card in cards:
    print(card)

Submission status: Accepted

Solution code:
n=int(input())
arr = [[False for i in range(13)] for j in range(4)]
for count in range(n):
    code = input().split()
    if (code[0]=="S"):
        arr[0][int(code[1])-1]=True
    elif (code[0]=="H"):
        arr[1][int(code[1])-1]=True
    elif(code[0]=="C"):
        arr[2][int(code[1])-1]=True
    else:
        arr[3][int(code[1])-1]=True

for i in range(4):
    if(i==0):
        img="S"
    elif(i==1):
        img="H"
    elif(i==2):
        img="C"
    else:
        img="D"
    for j in range(13):
        if(arr[i][j]==False):
            print(img+" "+str(j+1))

Submission status: Accepted

Solution code:
n = int(input())
l = [0]*53
for i in range(n):
    a, b = input().split()
    b = int(b)
    if a == "H":
        b += 13
    elif a == "C":
        b += 26
    elif a == "D":
        b += 39
    l[b] = 1 
for j in range(1,53):
    if l[j] != 1:
         ama = j % 13
         syou = j // 13
         if ama == 0:
             ama = 13
             syou -= 1 
         if syou == 0:
             zi = "S"
         elif syou == 1:
             zi = "H"
         elif syou == 2:
             zi = "C"
         else:
             zi = "D"
         print(zi, ama)

Submission status: Accepted

Solution code:
n = int(input())

cards = [[False for i in range(13)] for j in range(4)]

for i in range(n):
    n,m = input().split()
    m = int(m)
    if n == 'S':
        cards[0][m-1] = True
    elif n == 'H':
        cards[1][m-1] = True
    elif n == 'C':
        cards[2][m-1] = True
    elif n == 'D':
        cards[3][m-1] = True
for j in range(4):
    for i in range(13):
        if cards[j][i] == False:
            if j == 0:
                print('S ' + str(i+1))
            elif j == 1:
                print('H ' + str(i+1))
            elif j == 2:
                print('C ' + str(i+1))
            elif j == 3:
                print('D ' + str(i+1))

Submission status: Accepted

Solution code:
def printMissingNumber(cards, mark):
    for cardNum in range(1, 13 + 1):
        if not cardNum in cards:
            print("{0} {1}".format(mark, cardNum))


n = int(input())
s_cards = []
h_cards = []
c_cards = []
d_cards = []

for i in range(n):
    shape, num = input().split()
    num = int(num)
    target = None
    if shape == "H":
        target = h_cards
    elif shape == "D":
        target = d_cards
    elif shape == "C":
        target = c_cards
    elif shape == "S":
        target = s_cards
    target.append(num)

printMissingNumber(s_cards, "S")
printMissingNumber(h_cards, "H")
printMissingNumber(c_cards, "C")
printMissingNumber(d_cards, "D")

Submission status: Accepted

Solution code:
n = input()
s = [0] * 13
h = [0] * 13
c = [0] * 13
d = [0] * 13
for i in range(n):
    x = map(str, raw_input().split())
    if x[0] == 'S':
        s[int(x[1]) - 1] = 1
    if x[0] == 'H':
        h[int(x[1]) - 1] = 1
    if x[0] == 'C':
        c[int(x[1]) - 1] = 1
    if x[0] == 'D':
        d[int(x[1]) - 1] = 1
for i in range(13):
    if s[i] == 0:
        print 'S', (i+1)
for i in range(13):
    if h[i] == 0:
        print 'H', (i+1)
for i in range(13):
    if c[i] == 0:
        print 'C', (i+1)
for i in range(13):
    if d[i] == 0:
        print 'D', (i+1)

Submission status: Accepted

Solution code:
n = int(input())
s = {('S',str(i)) for i in range(1,14)}
h = {('H',str(i)) for i in range(1,14)}
c = {('C',str(i)) for i in range(1,14)}
d = {('D',str(i)) for i in range(1,14)}

for i in range(n):
    t = tuple(input().split())
    if t[0] == 'S':
        s = s - {t} 
    elif t[0] == 'H':
        h = h - {t}
    elif t[0] == 'C':
        c = c - {t}
    else :
        d = d - {t}

for i in map(list,[s,h,c,d]):
    for j in sorted(i,key=lambda x:int(x[1])):
        print(" ".join(j))

Submission status: Accepted

Solution code:
n=int(input())
suit = ["S","H","C","D"]
card = {i:[] for i in suit}
for i in range(n):
   tmp = ([c for c in input().split()])
   card[tmp[0]].append(tmp[1])

for i in suit:
    for j in range(1,14):
        if not (str(j) in card[i]):
            print("%s %s" % (i,j))

Submission status: Accepted

Solution code:
n = int(input())
cards = set()
for _ in range(n):
	cards |= {input()}

for s in ["S","H","C","D"]:
	for n in range(1,14):
		needle = s + " " + str(n)
		if not needle in cards:
			print(needle)

Submission status: Accepted

Solution code:
mark = ["S", "H", "C", "D"]
cards = []
for m in mark:
    for i in range(1, 14):
        cards.append(m + " " + str(i))
n = int(input())
for j in range(n):
    cards.remove(input())

for c in cards:
    print(c)

Submission status: Accepted

Solution code:
S = []
H = []
C = []
D = []
for i in (S, H, C, D):
        for k in range(1, 13+1):
            i.append(k)


for u in range(0, int(input())):
    x, y = (i for i in input().split())
    if x == "S":
        S.remove(int(y))
    elif x == "H":
        H.remove(int(y))
    elif x == "C":
        C.remove(int(y))
    else:
        D.remove(int(y))
if len(S) > 0:
    for s in range(0, len(S)):
        print("S",S[s])
if len(H) > 0:
    for h in range(0, len(H)):
        print("H",H[h])
if len(C) > 0:
    for c in range(0, len(C)):
        print("C",C[c])
if len(D) > 0:
    for d in range(0, len(D)):
        print("D",D[d])

Submission status: Accepted

Solution code:
data = [
    "{0} {1}".format(s, r)
    for s in ('S', 'H', 'C', 'D')
    for r in range(1, 13 + 1)
    ]

count = int(input())
for c in range(count):
    card = input()
    data.remove(card)

for c in data:
    print(c)

Submission status: Accepted

Solution code:
data = [                                      
    "{0} {1}".format(s, r)                    
    for s in ('S', 'H', 'C', 'D')             
    for r in range(1, 13+1)                   
    ]                                         
                                              
count = int(input())                          
for c in range(count):                        
    card = input()                            
    data.remove(card)                         
                                              
for c in data:                                
    print(c)

Submission status: Accepted

Solution code:
data = [
    "{0} {1}" .format(s, r)
    for s in ('S','H','C','D')
    for r in range(1, 13 + 1)
    ]

count = int(input())
for c in range(count):
    card = input()
    data.remove(card)

for c in data:
    print(c)

Submission status: Accepted

Solution code:
deck = [(s, n) for s in ['S', 'H', 'C', 'D'] for n in range(1,  14)]
N = input()
for n in range(N):
    s, n = raw_input().split()
    deck.remove((s, int(n)))

for s, n in deck:
    print s, n

Submission status: Accepted

Solution code:
data = [
    "{0} {1}".format(s, r)
    for s in ('S', 'H', 'C', 'D')
    for r in range(1, 13 + 1)
    ]
 
count = int(input())
for c in range(count):
    card = input()
    data.remove(card)
 
for c in data:
    print(c)

Submission status: Accepted

Solution code:
data = [
    "{0} {1}".format(s, r)
    for s in ('S','H','C','D')
    for r in range(1,13+1)
]

count =int(input())
for c in range(count):
    card = input()
    data.remove(card)

for c in data:
    print(c)

Submission status: Accepted

Solution code:
data = [
    '{0} {1}'.format(s, r)
    for s in ('S', 'H', 'C', 'D')
    for r in range(1, 13 + 1)
    ]

count = int(input())
for c in range(count):
    card = input()
    data.remove(card)

for c in data:
 print(c)

Submission status: Accepted

Solution code:
date = [
    "{0} {1}".format(s,r)
    for s in ('S', 'H', 'C', 'D')
    for r in range(1,13+1)
    ]

count= int(input())
for c in range(count):
    card = input()
    date.remove(card)

for c in date:
    print(c)

Submission status: Accepted

Solution code:
data = [
     "{0} {1}".format(s, r) 
      for s in ('S', 'H', 'C', 'D')
      for r in range(1, 13 +1)
        ]
count = int(input())
for c in range(count):
      card = input()
      data.remove(card)

for c in data:
   print(c)

Submission status: Accepted

Solution code:
data = [
    "{0} {1}".format(s,r)
        for s in ('S','H','C','D')
        for r in range(1, 13+1)
]

count = int(input())
for c in range(count):
    card = input()
    data.remove(card)
for c in data:
    print(c)

Submission status: Accepted

Solution code:
data = [
     "{0} {1}".format(s, r) 
      for s in ('S', 'H', 'C', 'D')
      for r in range(1, 13 +1)
        ]
count = int(input())
for c in range(count):
      card = input()
      data.remove(card)
 
for c in data:
   print(c)

Submission status: Accepted

Solution code:
data = [
    "{0} {1}".format(s, r)
    for s in ('S', 'H', 'C', 'D')
    for r in range(1, 13 + 1)
]
count = int(input())
for c in range(count):
    card = input()
    data.remove(card)

for c in data:
    print(c)

Submission status: Accepted

Solution code:
data = [
    "{0} {1}".format(s, r)
    for s in ('S', 'H', 'C', 'D')
    for r in range(1, 13 + 1)
]
count = int(input())
for c in range(count):
    card = input()
    data.remove(card)
 
for c in data:
    print(c)

Submission status: Accepted

Solution code:
cards = [
'S 1', 'S 2', 'S 3', 'S 4', 'S 5', 'S 6', 'S 7', 'S 8', 'S 9', 'S 10', 'S 11', 'S 12', 'S 13',
'H 1', 'H 2', 'H 3', 'H 4', 'H 5', 'H 6', 'H 7', 'H 8', 'H 9', 'H 10', 'H 11', 'H 12', 'H 13',
'C 1', 'C 2', 'C 3', 'C 4', 'C 5', 'C 6', 'C 7', 'C 8', 'C 9', 'C 10', 'C 11', 'C 12', 'C 13',
'D 1', 'D 2', 'D 3', 'D 4', 'D 5', 'D 6', 'D 7', 'D 8', 'D 9', 'D 10', 'D 11', 'D 12', 'D 13'
]

n = int(input())
for i in range(n):
    card = input()
    cards.remove(card)

for i in cards:
    print(i)

Submission status: Accepted

Solution code:
n = int(input())
deck = []

for i in range(n):
	mark, num = input().split()
	deck.append((mark, int(num)))

for mark, num in [(mark, num) for mark in 'SHCD' for num in range(1,14) if (mark, num) not in deck]:
	print(mark, num)

Submission status: Accepted

Solution code:
n=int(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)

Submission status: Accepted

Solution code:
n = int(input())
S = [0] * 13
H = [0] * 13
C = [0] * 13
D = [0] * 13
for i in range(n):
	mark,val = raw_input().split()
	val = int(val)
	if mark=="S":
		S[val-1] = 1
	elif mark=="H":
		H[val-1] = 1
	elif mark=="C":
		C[val-1] = 1
	else: # mark=="D"
		D[val-1] = 1

for i in range(0,13):
	if S[i]==0: print "S %s" % (i+1)
for i in range(0,13):
	if H[i]==0: print "H %s" % (i+1)
for i in range(0,13):
	if C[i]==0: print "C %s" % (i+1)
for i in range(0,13):
	if D[i]==0: print "D %s" % (i+1)

Submission status: Accepted

Solution code:
n = int(input())
list =['1','2','3','4','5','6','7','8','9','10','11','12','13']
S_list = list.copy()
H_list = list.copy()
C_list = list.copy()
D_list = list.copy()
for i in range(n):
    a = input()
    b = a.split(' ')
    if b[0] == 'S':
        S_list.remove('%s'%(b[1]))
    elif b[0] == 'H':
        H_list.remove('%s'%(b[1]))
    elif b[0] == 'C':
        C_list.remove('%s'%(b[1]))
    elif b[0] == 'D':
        D_list.remove('%s'%(b[1]))
for i in S_list:
    print('S '+i)
for e in H_list:
    print('H '+e)
for f in C_list:
    print('C '+f)
for g in D_list:
    print('D '+g)

Submission status: Accepted

Solution code:
n = int(input())
S = []
H = []
C = []
D = []

for x in range(0,n):
    L = raw_input().split()
    if L[0] == "S": S.append(int(L[1]))
    elif L[0] == "H": H.append(int(L[1]))
    elif L[0] == "C": C.append(int(L[1]))
    else: D.append(int(L[1]))

for x in range(1,14):
    if not x in S: print "S {}".format(x)
for x in range(1,14):
    if not x in H: print "H {}".format(x)
for x in range(1,14):
    if not x in C: print "C {}".format(x)
for x in range(1,14):
    if not x in D: print "D {}".format(x)

Submission status: Accepted

Solution code:
n = int(input())
S = []
H = []
C = []
D = []
 
for x in range(0,n):
    L = raw_input().split()
    if L[0] == "S": S.append(int(L[1]))
    elif L[0] == "H": H.append(int(L[1]))
    elif L[0] == "C": C.append(int(L[1]))
    else: D.append(int(L[1]))
 
for x in range(1,14):
    if not x in S: print "S {}".format(x)
for x in range(1,14):
    if not x in H: print "H {}".format(x)
for x in range(1,14):
    if not x in C: print "C {}".format(x)
for x in range(1,14):
    if not x in D: print "D {}".format(x)

Submission status: Accepted

Solution code:
import sys

input()
card = sys.stdin.readlines()
bool_ = [[False for y in range(13)] for x in range(4)]

for i in card:
    m, n = i.split()
    m = m.replace('S', '0').replace('H', '1').replace('C', '2').replace('D', '3')
    m, n = int(m), int(n)
    bool_[m][n - 1] = True

for i in range(4):
    for j in range(13):
        if not bool_[i][j]:
            if i == 0:
                print('S', j + 1)
            elif i == 1:
                print('H', j + 1)
            elif i == 2:
                print('C', j + 1)
            else:
                print('D', j + 1)

Submission status: Accepted

Solution code:
n = int(input())
n_cards = [input() for _ in range(n)]
suits = ['S', 'H', 'C', 'D']
for suit in suits:
    for i in range(1, 14):
        if suit + ' ' + str(i) not in n_cards:
            print(suit + ' ' + str(i))

Submission status: Accepted

Solution code:
n = int(raw_input())
S = [0 for i in range(13)]
H = [0 for i in range(13)]
C = [0 for i in range(13)]
D = [0 for i in range(13)]

for i in range(n):
    card = str(raw_input())
    if card[0] == 'S':
        for j in range(13):
            if str(j+1) == card[2:len(card)]:
                S[j] = 1
    elif card[0] == 'H':
        card.replace("H ", "")
        for j in range(13):
            if str(j+1) == card[2:len(card)]:
                H[j] = 1
    elif card[0] == 'C':
        card.replace("C ", "")
        for j in range(13):
            if str(j+1) == card[2:len(card)]:
                C[j] = 1
    elif card[0] == 'D':
        card.replace("D ", "")
        for j in range(13):
            if str(j+1) == card[2:len(card)]:
                D[j] = 1
                
for i in range(13):
    if S[i] == 0:
        print "S %d" % (i+1)
for i in range(13):
    if H[i] == 0:
        print "H %d" % (i+1)
for i in range(13):
    if C[i] == 0:
        print "C %d" % (i+1)
for i in range(13):
    if D[i] == 0:
        print "D %d" % (i+1)

Submission status: Accepted

Solution code:
def search(num, items, Mark):
    printlist = []
    for i in range(num):
        if not(i+1 in items):
            print(Mark, i+1)

n = int(input())
Slist = []
Hlist = []
Clist = []
Dlist = []
for i in range(n):
    MN = input().split()
    mark = MN[0]
    number = int(MN[1])
    if mark == "S":
        Slist.append(number)
    elif mark == "H":
        Hlist.append(number)
    elif mark == "C":
        Clist.append(number)
    else:
        Dlist.append(number)
    i = i+1

search(13, Slist, "S")
search(13, Hlist, "H")
search(13, Clist, "C")
search(13, Dlist, "D")

Submission status: Accepted

Solution code:
s = range(1,14)
h = range(1,14)
c = range(1,14)
d = range(1,14)

n = input()

for i in range(n):
	mark, number = raw_input().split()

	if mark == 'S':
		s[int(number)-1] = 0
	elif mark == 'H':
		h[int(number)-1] = 0
	elif mark == 'C':
		c[int(number)-1] = 0
	elif mark == 'D':
		d[int(number)-1] = 0

for i in range(13):
	if s[i] != 0:
		print "S %d" %s[i]
for i in range(13):
	if h[i] != 0:
		print "H %d" %h[i]
for i in range(13):
	if c[i] != 0:
		print "C %d" %c[i]
for i in range(13):
	if d[i] != 0:
		print "D %d" %d[i]

Submission status: Accepted

Solution code:
import sys

def make_all_cards():
    mark = ['S', 'H', 'C', 'D']
    cards = []
    
    for i in mark:
        for n in range(1, 14):
            cards.append(i + ' ' + str(n))

    return cards

if __name__ == '__main__':
    all_cards = make_all_cards()
    n = int(sys.stdin.readline().strip())

    for _ in range(n):
        card = sys.stdin.readline().strip()
        all_cards.remove(card)

    for i in all_cards:
        print(i)