import std.stdio, std.algorithm, std.conv, std.string;

enum arrow { L,R,U,D };

void main(){
	int n = readln.chomp.to!int();
	const arrow[dchar] toArrow = [ 'L':arrow.L, 'R':arrow.R, 'U':arrow.U, 'D':arrow.D ];
	foreach(i; 0..n){
		auto score =  readln.chomp.map!(a=>toArrow[a])();
		writeln(score.isNatural? "Yes": "No");
	}
}

bool isNatural(T)(T score){
	arrow prev = cast(arrow)-1;
	bool startLeft = true;
	bool startRight = true;
	bool startFoot = true;
	foreach(s; score){
		if(prev == s) return false;
		if(s == arrow.L){
			startLeft = startLeft && startFoot;
			startRight = startRight && !startFoot;
		}else if(s == arrow.R){
			startLeft = startLeft && !startFoot;
			startRight = startRight && startFoot;
		}
		if(!(startLeft || startRight)) return false;
		prev = s;
		startFoot ^= true;
	}
	return true;
}