#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; string j[6] = { "AC","WA","TLE","MLE","OLE","RE" }; int main() { int n; cin >> n; for (int i = 0; i < n; i++) { int a[6], b[6]; cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4] >> a[5]; cin >> b[0] >> b[1] >> b[2] >> b[3] >> b[4] >> b[5]; string x; cin >> x; bool ans = false; for (int i = 0; i < 6; i++) { if (j[i] == x) { b[i] -= a[0] - b[0]; if (a[1] + a[2] + a[3] + a[4] + a[5] == b[i]) { ans = true; } } } if (ans) { cout << "Yes" << endl; } else { cout << "No" << endl; } } }