Card = Struct.new(:suit, :rank) do
  def self.all
    %w{S H C D}.flat_map{|s| 13.times.map{|r| Card.new(s, r+1) }}
  end

  def to_s
    "#{suit} #{rank}"
  end
end

set = Card.all

gets.to_i.times {
  suit, rank = gets.split
  rank = rank.to_i

  set.delete Card.new(suit, rank)
}

puts set

