pub mod kit {
    use std::io::{BufRead, Read};
    use std::str::{self, FromStr};

    pub struct Scanner<R> {
        reader: R,
        buff: Vec<u8>,
    }

    impl<R: BufRead> Scanner<R> {
        pub fn new(reader: R) -> Self {
            Self {
                reader,
                buff: Vec::new(),
            }
        }

        #[allow(unused)]
        #[inline]
        pub fn read_line<T: FromStr>(&mut self) -> T
        where
            <T as FromStr>::Err: ::std::fmt::Debug,
        {
            self.read_until(b'\n')
        }

        #[allow(unused)]
        #[inline]
        pub fn read<T: FromStr>(&mut self) -> T
        where
            <T as FromStr>::Err: ::std::fmt::Debug,
        {
            self.read_until(b' ')
        }

        #[inline]
        fn read_until<T: FromStr>(&mut self, delim: u8) -> T
        where
            <T as FromStr>::Err: ::std::fmt::Debug,
        {
            loop {
                self.buff.clear();
                match self.reader.read_until(delim, &mut self.buff).unwrap() {
                    0 => panic!("EOF read"),
                    1 if (self.buff[0] as char).is_whitespace() => (),
                    n => {
                        if (self.buff[n - 1] as char).is_whitespace() {
                            self.buff.truncate(n - 1);
                        }
                        break;
                    }
                }
            }
            str::from_utf8(&self.buff)
                .unwrap()
                .parse()
                .unwrap_or_else(|err| panic!(format!("{:?}", err)))
        }

        pub fn next<T: FromStr>(&mut self) -> T
        where
            <T as FromStr>::Err: ::std::fmt::Debug,
        {
            self.reader
                .by_ref()
                .bytes()
                .map(|b| b.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect::<String>()
                .parse::<T>()
                .unwrap()
        }
    }
}


// let cin = std::io::stdin();
// let mut sc = scanner!(cin);
#[allow(unused)]
macro_rules! scanner {
    ($stdin:expr) => {
        kit::Scanner::new($stdin.lock())
    };
}
use std::collections::HashMap;

#[derive(Debug, PartialEq, Eq, Hash)]
pub enum Suit {
    Spade,
    Heart,
    Club,
    Diamond,
}

#[derive(Debug)]
pub struct ParseSuitError {}

impl std::str::FromStr for Suit {
    type Err = ParseSuitError;

    fn from_str(s: &str) -> Result<Self, Self::Err> {
        match s {
            "s" | "S" => Ok(Suit::Spade),
            "h" | "H" => Ok(Suit::Heart),
            "c" | "C" => Ok(Suit::Club),
            "d" | "D" => Ok(Suit::Diamond),
            _ => Err(ParseSuitError {}),
        }
    }
}

#[allow(dead_code)]
impl Suit {
    pub fn str(&self) -> &str {
        match *self {
            Suit::Spade => "spade",
            Suit::Heart => "heart",
            Suit::Club => "club",
            Suit::Diamond => "diamond",
        }
    }
}

#[allow(dead_code)]
pub struct Card {
    pub suit: Suit,
    pub number: u8,
}

#[allow(dead_code)]
pub struct Deck {
    pub cards: std::collections::HashMap<Suit, [bool; 13]>,
}

#[allow(dead_code)]
impl Deck {

    pub fn new() -> Self {
        let mut cards = HashMap::new();
        cards.insert(Suit::Spade, [true; 13]);
        cards.insert(Suit::Heart, [true; 13]);
        cards.insert(Suit::Club, [true; 13]);
        cards.insert(Suit::Diamond, [true; 13]);

        Self { cards }
    }

    pub fn pick(&mut self, card: &Card) {
        self.cards.get_mut(&card.suit).unwrap()[(card.number - 1) as usize] = false;
    }
}

use std::str::FromStr;

fn main() {
    let stdin = std::io::stdin();
    let mut sc = scanner!(stdin);

    let mut deck = Deck::new();
    let n: u8 = sc.next();
    for _ in 0..n {
        let card = Card {
            suit: Suit::from_str(&sc.next::<String>()).unwrap(),
            number: sc.next(),
        };
        deck.pick(&card)
    }

    for suit in &[Suit::Spade, Suit::Heart, Suit::Club, Suit::Diamond] {
        let cards = deck.cards.get(suit).unwrap();
        for (i, c) in cards.iter().enumerate() {
            if *c {
                println!(
                    "{} {}",
                    (&suit.str()[0..1]).to_string().to_uppercase(),
                    i + 1
                );
            }
        }
    }

}


Measured memory_bytes: 5048