process.stdin.resume();
process.stdin.setEncoding("utf8");
process.stdin.on("data", function (chunk) {
    var input = chunk.trim().split("\n");
    var n = input.shift();
    for (var i = 0; i < n; i++) {
        var data = input[i].split(/\s+/).map(Number);

        console.log(scores(data) ? "Yes" : "No");
    }
});

function console(data) {
    var left = true;
    var right = true;
    input += '!';
    for (var i = 0, i < data.length; i++) {
        if (input[i] == input[i + 1])
            return false;
        if (input[i] == 'L' && i % 2 == 1)
            left = false;
        if (input[i] == 'R' && i % 2 == 0)
            left = false;
        if (input[i] == 'L' && i % 2 == 0)
            right = false;
        if (input[i] == 'R' && i % 2 == 1)
            right = false;
    }

    return (left | right);
}