#ifdef SENJAN #include #else #pragma GCC target("avx2") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #define debug(...) #endif #include #include using namespace std; using namespace atcoder; using ll=long long; using ull=unsigned long long; using ld=long double; using graph=vector>; template using wgraph=vector>>; template using min_priority_queue=priority_queue,greater>; constexpr int INF32=INT_MAX/2; constexpr ll INF64=1LL<<60; constexpr ld PI=3.14159265358979323846; constexpr int dx[]={0,0,-1,1,-1,-1,1,1},dy[]={-1,1,0,0,-1,1,-1,1}; #define rep(i,s,n) for(ll i=(ll)(s);i<(ll)(n);i++) #define rrep(i,s,n) for(ll i=(ll)(s);i>=(ll)(n);i--) template inline bool chmax(T &a,T b){return a inline bool chmin(T &a,T b){return a>b?a=b,true:false;} void _main(); int main(){cin.tie(0)->sync_with_stdio(0);cout<> a.x >> a.y >> a.d; cin >> b.x >> b.y >> b.d; if(a.d==b.d) return false; if(a.x==b.x){ if(a.y>b.y) swap(a, b); if(a.d=='U' && b.d=='D') return true; return false; } if(a.y==b.y){ if(a.x>b.x) swap(a, b); if(a.d=='R' && b.d=='L') return true; return false; } if(a.d>b.d) swap(a, b); if(a.d=='D' && b.d=='U') return false; if(a.d=='L' && b.d=='R') return false; if(a.d=='L' || a.d=='R') swap(a, b); if(a.d=='D'){ if(a.y<=b.y) return false; if(b.d=='R'){ if(a.x<=b.x) return false; if(a.x-b.x == a.y-b.y) return true; return false; } if(b.d=='L'){ if(a.x>=b.x) return false; if(b.x-a.x == a.y-b.y) return true; return false; } } if(a.d=='U'){ if(a.y>=b.y) return false; if(b.d=='R'){ if(a.x<=b.x) return false; if(a.x-b.x == b.y-a.y) return true; return false; } if(b.d=='L'){ if(a.x>=b.x) return false; if(b.x-a.x == b.y-a.y) return true; return false; } } return false; } void _main(){ int T; cin >> T; while(T--){ cout << (solve()?"Yes":"No") << endl; } }