#include using namespace std; using ll=long long; int main(){ ll t; cin>>t; while(t--){ vector x(2),y(2); vector d(2); for(ll i=0;i<2;i++){ cin>>x[i]>>y[i]>>d[i]; } vector> dir(2,vector(2)); for(ll i=0;i<2;i++){ if(d[i]=='R'){ dir[i][0]=1; dir[i][1]=0; }else if(d[i]=='L'){ dir[i][0]=-1; dir[i][1]=0; }else if(d[i]=='U'){ dir[i][0]=0; dir[i][1]=1; }else{ dir[i][0]=0; dir[i][1]=-1; } } bool ok=false; if(dir[1][0]!=dir[0][0]){ ll k=(x[0]-x[1])/(dir[1][0]-dir[0][0]); if(k>=0&&(y[0]-y[1])==k*(dir[1][1]-dir[0][1])){ ok=true; } } if(dir[1][1]!=dir[0][1]){ ll k=(y[0]-y[1])/(dir[1][1]-dir[0][1]); if(k>=0&&(x[0]-x[1])==k*(dir[1][0]-dir[0][0])){ ok=true; } } if(ok){ cout<<"Yes"<