// main.cpp
#include <fstream>
#include <iostream>

using namespace std;

void rotateRecursive(char *bestpath, int *rcount, int numCount, int curPos, int target, char *path, int depth, int maxDepth, int *rotLens)
{
	if(depth < maxDepth)
	{
		int newPos;

		newPos = curPos + rotLens[depth];
		if(newPos > numCount) newPos -= numCount;

		path[depth] = 'U';
		path[depth+1] = '\0';

		rotateRecursive(bestpath, rcount, numCount, newPos, target, path, depth + 1, maxDepth, rotLens);

		newPos = curPos - rotLens[depth];
		if(newPos < 1) newPos += numCount;

		path[depth] = 'D';
		path[depth+1] = '\0';

		rotateRecursive(bestpath, rcount, numCount, newPos, target, path, depth + 1, maxDepth, rotLens);

		path[depth] = '\0';
	}
	else
	{
		if(curPos == target)
		{
			(*rcount)++;
			strcpy(bestpath, path);
		}
	}
}

int main()
{
	fstream fin;
	int testCount;

	fin.open("HACK.IN");
	
	fin >> testCount;

	for(int i = 0; i < testCount; i++)
	{
		int numCount, startPos, endPos, rotCount;
		fin >> numCount >> startPos >> endPos >> rotCount;

		int rotLens[100];
		for(int j = 0; j < rotCount; j++)
		{
			fin >> rotLens[j];
		}

		int resCount = 0;
		char resPath[100] = "\0";
		char temp[100] = "\0";

		rotateRecursive(resPath, &resCount, numCount, startPos, endPos, temp, 0, rotCount, rotLens);

		if(resCount > 0)
			cout << resCount << ' ' << resPath << endl;
		else
			cout << resCount << endl;
	}

	fin.close();

	return 0;
}