import scala.annotation.tailrec
import scala.io.StdIn._
object Main extends App {
  val n = readInt()
  for (_ ← 0 until n) {
    println(if (isNatural(readLine.trim.map{
      case 'U' ⇒ UpStep
      case 'D' ⇒ DownStep
      case 'L' ⇒ LeftStep
      case 'R' ⇒ RightStep
      case _ ⇒ ???
    }.toList)) "Yes" else "No")
  }
  def isNatural(steps: List[Step]): Boolean = {
    steps match {
      case Nil ⇒ true
      case h::t ⇒ isNatural(t, h, RightFoot) || isNatural(t, h, LeftFoot)
    }
  }
  @tailrec def isNatural(steps: List[Step], prevStep: Step, prevFoot: Foot): Boolean = {
    steps match {
      case Nil ⇒ true
      case h::t if prevStep != h ⇒
        prevFoot match {
          case LeftFoot ⇒ h.isRightOf(prevStep) && isNatural(t, h, RightFoot)
          case RightFoot ⇒ h.isLeftOf(prevStep) && isNatural(t, h, LeftFoot)
        }
      case _ ⇒ false
    }
  }
  sealed trait Foot
  object LeftFoot extends Foot
  object RightFoot extends Foot
  sealed trait Step {
    def isRightOf(that: Step): Boolean = {
      (this, that) match {
        case (RightStep, _) ⇒ true
        case (_, RightStep) ⇒ false
        case (_, LeftStep) ⇒ true
        case (LeftStep, _) ⇒ false
        case _ ⇒ true
      }
    }
    def isLeftOf(that: Step): Boolean = {
      (this, that) match {
        case (LeftStep, _) ⇒ true
        case (_, LeftStep) ⇒ false
        case (_, RightStep) ⇒ true
        case (RightStep, _) ⇒ false
        case _ ⇒ true
      }
    }
  }
  object LeftStep extends Step
  object UpStep extends Step
  object DownStep extends Step
  object RightStep extends Step
}
