#include #include #include #include #include #include #include #include #include using namespace std; void solve(){ vector res = {"AC", "WA", "TLE", "MLE", "OLE", "RE"}; vector a(6), b(6); string s; int idx = -1; int cnt = 0; for(int j = 0; j < 6; j++){ cin >> a[j]; cnt += a[j]; } for(int j = 0; j < 6; j++) cin >> b[j]; cin >> s; for(int j = 0; j < 6; j++) if (s == res[j]) idx = j; if (idx != 0 && a[idx] != 0) cout << "No" << endl; else { if (idx == 0) cout << ((b[0] == cnt) ? "Yes" : "No" ) << endl; else cout << ((cnt - b[0] == b[idx]) ? "Yes" : "No" ) << endl; } } int main() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); int n; cin >> n; for (int i = 0; i < n; i++) solve(); }