gets
s, h, c, h = [], [], [], []
ARGF.each_line do |line|
  s << line.to_s if line.include?("S")
  h << line.to_s if line.include?("H")
  c << line.to_s if line.include?("C")
  d << line.to_s if line.include?("D")
end
s.sort!
h.sort!
c.sort!
d.sort!
puts