#include #include #include using namespace std; using namespace atcoder; typedef long long ll; typedef unsigned long long ull; using mint9 = modint998244353; using mint1 = modint1000000007; //using mint = modint; const ll INF = 1000000007; const ll LINF = INF * INF; //const long long LLMAX = 9223372036854775807; const long long LLMAX = 100000000000000000; const double TIME_1 = 1.5; //const ll MOD = 998244353; std::mt19937 get_rand_mt; #define PA pair #define PAL pair #define TP tuple #define TPL tuple #define rep(i, z, n) for(int i = z; i < n; i++) #define repl(i, z, n) for(ll i = z; i < n; i++) #define revrep(i, z, n) for(int i = n - 1; i >= z; i--) #define revrepl(i, z, n) for(ll i = n - 1; i >= z; i--) #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() #define SZ(x) ((int)(x).size()) #define PB push_back #define YN(T) if(T){cout<<"Yes"<,greater> #define PQL priority_queue,greater> #define PQPA priority_queue,greater> templatebool chmax(T &a, const T &b) { if (abool chmin(T &a, const T &b) { if (bT ceilX(T a, T b) {return (a + b - 1)/b; } ll lmax(ll a, ll b){if(a>b) return a; return b;} ll lmin(ll a, ll b){if(a>b) return b; return a;} ll comb(ll X, ll Y){ll res = 1LL;ll R = X;repl(i, 1LL, lmin(Y + 1LL, X - Y + 1LL)){res *= (R - i + 1LL);res /= i;}return res;} templatevoid Rekkyo(vector X){cout<<"Rekkyo"<void Rekkyo1(vector X){cout<<"Rekkyo1"<void Rekkyo2(vector> X){cout<<"Rekkyo2"< Eratosthenes(const int N){ vector is_prime(N + 1); rep(i, 0, N + 1) is_prime[i] = true; vector P; rep(i, 2, N + 1){ if(is_prime[i]){ for( int j = 2 * i; j <= N; j += i ) is_prime[ j ] = false; P.emplace_back(i); } } return P; } vector> make_edge(vector u, vector v, bool angle){ int N = u.size(); vector> res; rep(i, 0, N){res[u[i]].PB(v[i]);if(!angle) res[v[i]].PB(u[i]);} return res; } vector> make_edge(vector u, vector v, vector w, bool angle){ int N = u.size(); vector> res; rep(i, 0, N){res[u[i]].PB(PA(v[i], w[i]));if(!angle) res[v[i]].PB(PA(u[i], w[i]));} return res; } vector> make_edgeL(vector u, vector v, vector w, bool angle){ int N = u.size(); vector> res; rep(i, 0, N){res[u[i]].PB(PAL(v[i], w[i]));if(!angle) res[v[i]].PB(PAL(u[i], w[i]));} return res; } int main(){ int T; cin >> T; rep(t, 0, T){ vector x(2), y(2); vector d(2); cin >> x[0] >> y[0] >> d[0] >> x[1] >> y[1] >> d[1]; vector D(2); rep(i, 0, 2){ if(d[i] == 'R'){ D[i] = -1; } if(d[i] == 'L'){ D[i] = 1; } if(d[i] == 'U'){ D[i] = -2; } if(d[i] == 'D'){ D[i] = 2; } } bool ans = false; if(D[0] == D[1]) ans = false; else if(D[0] == -D[1]){ if(D[0] == -1){ if(y[0] != y[1]) ans = false; else if(x[0] > x[1]) ans = false; else ans = true; } if(D[0] == 1){ if(y[0] != y[1]) ans = false; else if(x[0] < x[1]) ans = false; else ans = true; } if(D[0] == -2){ if(x[0] != x[1]) ans = false; else if(y[0] > y[1]) ans = false; else ans = true; } if(D[0] == 2){ if(x[0] != x[1]) ans = false; else if(y[0] < y[1]) ans = false; else ans = true; } } else{ if(D[0] == -1){ if(D[1] == -2){ if(-x[0] + x[1] == y[0] - y[1]) ans = true; else ans = false; } if(D[1] == 2){ if(-x[0] + x[1] == -y[0] + y[1]) ans = true; else ans = false; } } if(D[0] == 1){ if(D[1] == -2){ if(x[0] - x[1] == y[0] - y[1]) ans = true; else ans = false; } if(D[1] == 2){ if(x[0] - x[1] == -y[0] + y[1]) ans = true; else ans = false; } } if(D[0] == -2){ if(D[1] == -1){ if(x[0] - x[1] == -y[0] + y[1]) ans = true; else ans = false; } if(D[1] == 1){ if(-x[0] + x[1] == -y[0] + y[1]) ans = true; else ans = false; } } if(D[0] == 2){ if(D[1] == -1){ if(x[0] - x[1] == y[0] - y[1]) ans = true; else ans = false; } if(D[1] == 1){ if(-x[0] + x[1] == y[0] - y[1]) ans = true; else ans = false; } } } YN(ans); } }