use std::io::*; fn main() { let mut s: String = String::new(); std::io::stdin().read_to_string(&mut s).ok(); let mut itr = s.trim().split_whitespace(); let n: usize = itr.next().unwrap().parse().unwrap(); let a: Vec = (0..n).map(|_| itr.next().unwrap().to_string()).collect(); let mut map = std::collections::HashMap::new(); for i in 0..n { let p = map.entry(a[i].clone()).or_insert(false); *p = true; } let mut cnt = 0; for a in ['D', 'C', 'H', 'S'].to_vec() { for b in [ 'A', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'T', 'J', 'Q', 'K', ] .to_vec() { let p = map.entry(format!("{}{}", a, b)).or_insert(false); if *p { print!("{}{}", a, b); cnt += 1; if cnt == n { println!(""); } else { print!(" "); } } } } }