#include using namespace std; using LL=long long; using ULL=unsigned long long; #define rep(i,n) for(int i=0; i<(n); i++) string A[]={"AC","WA","TLE","MLE","OLE","RE"}; void loop(){ int C[6][2]; rep(d,2) rep(i,6) cin>>C[i][d]; string S; cin>>S; bool ok=true; for(int i=1; i<6; i++) if(A[i]!=S) if(C[i][1]!=0) ok=false; cout<<(ok?"Yes":"No")<>T; while(T--) loop(); return 0; }