#include <iostream>
#include <string>
#include <cstring>
using namespace std;

char s[100010];

int main(void){
  int rightFlag;
  int j,i,n;
  int foot[2];
  char before;
  cin>>n;
  while(n--){
    cin>>s;
    for(j = 0 ; j < 2 ; j ++){
      foot[0] = -1;
      foot[1] = 1;
      rightFlag = j;
      before = 0;
      for(i = 0 ; i < strlen(s) ; i ++){
        if(before == s[i])break;
        switch(s[i]){
          case 'U' :
          case 'D' :
            foot[rightFlag] = 0;
            break;
          case 'R' :
            foot[rightFlag] = 1;
            break;
          case 'L' :            
            foot[rightFlag] = -1;
            break;
        }
        if(foot[0] > foot[1]) break;
        before = s[i];
        rightFlag = !rightFlag;
      }
      if(i == strlen(s)) break;
    }
    cout<<(j<2?"Yes":"No")<<endl;
  }
  return 0;
}