#define rep(i,n) for(int i=0;i<(int)(n);i++) #define ALL(v) v.begin(),v.end() typedef long long ll; #include using namespace std; int main(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); int t; cin>>t; while(t--){ ll x1,y1,x2,y2; char d1,d2; cin>>x1>>y1>>d1>>x2>>y2>>d2; if(d1==d2){ cout<<"No\n"; } else if(d1=='U' && d2=='D'){ if(x1==x2 && y1