n = gets.to_i
arr =[]
n.times do
  arr << gets.chomp
end

ans_arr = []

13.times do |i|
  ans_arr << "S"+" "+(i+1).to_s
  ans_arr << "H"+" "+(i+1).to_s
  ans_arr << "C"+" "+(i+1).to_s
  ans_arr << "D"+" "+(i+1).to_s
end

arr.each do |v|
  ans_arr.delete(v)
end

puts ans_arr.select{|v| v.include?("S")}
puts ans_arr.select{|v| v.include?("H")}
puts ans_arr.select{|v| v.include?("C")}
puts ans_arr.select{|v| v.include?("D")}

