use std::io; fn main() { let mut s = String::new(); io::stdin().read_line(&mut s).ok(); let n: usize = s.trim().parse().unwrap(); let mut v = [true; 10]; for _ in 0..n { let mut itr = String::new(); io::stdin().read_line(&mut itr).ok(); let mut itr = itr.trim().split_whitespace(); 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" { v[a] = false; v[b] = false; v[c] = false; v[d] = false; } else { for i in 0..10 { if !(i == a || i == b || i == c || i == d) { v[i] = false; } } } } for i in 0..10 { if v[i] { println!("{}", i); break; } } }