#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; int main() { int32_t n; cin >> n; for (auto i = 0; i < n; ++i) { vector xs(6), ys(6); for (auto &&x : xs) { cin >> x; } for (auto &&y : ys) { cin >> y; } string s; cin >> s; vector ss = {"AC", "WA", "TLE", "MLE", "OLE", "RE"}; auto si = distance(ss.begin(), find(ss.begin(), ss.end(), s)); bool ans = true; for (auto i = 0; i < 6; ++i) { if (i == si) continue; if (ys[i] > 0) ans = false; } cout << (ans ? "Yes" : "No") << endl; } return 0; }