#include #include using namespace std; int dx[] = {-2, -2, 0, 2, 2, 0}; int dy[] = {-1, 1, 2, 1, -1, -2}; const char *name[] = {"UL", "UR", "R", "LR", "LL", "L"}; int n, mex, mey, tox, toy; char sbuf[100500], *s=sbuf; void f() { for (int dl2 = (tox-mex)*(tox-mex) + (toy-mey)*(toy-mey); dl2 > 0; dl2 = (tox-mex)*(tox-mex) + (toy-mey)*(toy-mey)) { if (dl2 == 1) { printf("Impossible\n"); return; } int bestdl2 = 100500, bestmove; for (int i=0; i<6; ++i) { int nextx = mex + dx[i]; int nexty = mey + dy[i]; if (nextx < 0 || nextx >= n || nexty < 0 || nexty >= n) { continue; } int nextdl2 = (tox-nextx)*(tox-nextx) + (toy-nexty)*(toy-nexty); if (nextdl2 < bestdl2) { bestdl2 = nextdl2; bestmove = i; } } if (bestdl2 == 100500) { printf("Impossible\n"); return; } mex += dx[bestmove]; mey += dy[bestmove]; s += sprintf(s, "%s ", name[bestmove]); } printf("%s\n", sbuf); } int main() { scanf("%d", &n); scanf("%d%d%d%d", &mex, &mey, &tox, &toy); f(); }