#include using namespace std; using Int = int_fast64_t; using Word = uint_fast64_t; using VInt = vector; using VVI = vector; using VWord = vector; using VVW = vector; using VS = vector; using VVS = vector; using VB = vector; using VVB = vector; using PII = pair; using PWW = pair; using VPII = vector; using VPWW = vector; #define SZ(x) ((Int)(x).size()) #define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end()) #define rep(i,n) for(Int i=0, i##_len=(n); i> query; rep(i,query) { VInt a(6), b(6); rep(j,6) cin >> a[j]; rep(j,6) cin >> b[j]; string s; cin >> s; Int x = 0; // "AC" if (s == "WA") x = 1; if (s == "TLE") x = 2; if (s == "MLE") x = 3; if (s == "OLE") x = 4; if (s == "RE") x = 5; Int z = 0; Range(j, 1, 5) z += a[j]; bool flag = true; if (a[x] > 0) flag = false; Range(j, 1, 5) { if (j != x) { if (b[j] > 0) flag = false; } else { if (b[j] < z) flag = false; } } cout << (flag ? "Yes\n" : "No\n"); } return 0; }