#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<sstream>
#include<numeric>
#include<cassert>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define rep(i,s,n) for(int i=(s); i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()
#define IN(x,s,g) ((x) >= (s) && (x) < (g))
#define ISIN(x,y,w,h) (IN((x),0,(w)) && IN((y),0,(h)))
#define print(x) printf("%d\n",x)

using namespace std;

typedef unsigned int uint;
typedef long long ll;

const int _dx[] = {0,1,0,-1};
const int _dy[] = {-1,0,1,0};

int getInt(){
  int ret = 0,c;
  c = getchar();
  while(!isdigit(c)) c = getchar();
  while(isdigit(c)){
    ret *= 10;
    ret += c - '0';
    c = getchar();
  }
  return ret;
}

#define U 0
#define D 2
#define L 1
#define R 3

bool check[4][4];
int mapping[128];
int main(){
  int n;
  cin >> n;

  REP(i,4) REP(j,4) check[i][j] = true;

  check[R][L] = false;

  REP(i,4) check[i][i] = false;

  mapping['U'] = U;
  mapping['R'] = R;
  mapping['D'] = D;
  mapping['L'] = L;

  while(n --> 0){
    string str;
    bool ansl = true;
    bool ansr = true;
    cin >> str;
    for(int i=0; i<str.size()-1; i+=2){
      int l = mapping[str[i]];
      int r = mapping[str[i+1]];
      if(!check[l][r]){
        ansl = false;
      }
      if(!check[r][l]){
        ansr = false;
      }
    }
    puts((ansl | ansr)?"Yes":"No");
  }

  return 0;
}