use std::collections::HashMap; 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 mut mp: HashMap<&str, usize> = HashMap::new(); mp.insert("AC", 0); mp.insert("WA", 1); mp.insert("TLE", 2); mp.insert("MLE", 3); mp.insert("OLE", 4); mp.insert("RE", 5); for _ in 0..n { let mut a: Vec = (0..6) .map(|_| itr.next().unwrap().parse().unwrap()) .collect(); let b: Vec = (0..6) .map(|_| itr.next().unwrap().parse().unwrap()) .collect(); let s: &str = itr.next().unwrap(); let i = mp[s]; for j in 1..n { if i == j { continue; } a[i] += a[j]; a[j] = 0; } if a[i] <= b[i] { println!("Yes") } else { println!("No") } } }