use std::io::Read; fn main() { let mut s = 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 mut good = vec![true; 10]; for _ in 0..n { let a: usize = itr.next().unwrap().parse().unwrap(); let b: usize = itr.next().unwrap().parse().unwrap(); let c: usize = itr.next().unwrap().parse().unwrap(); let d: usize = itr.next().unwrap().parse().unwrap(); let s: &str = itr.next().unwrap(); if s == "NO" { good[a] = false; good[b] = false; good[c] = false; good[d] = false; } else { for i in 0..10 { if !(i == a || i == b || i == c || i == d) { good[i] = false; } } } } for i in 0..10 { if good[i] { println!("{}", i); } } }