#include #include #include #include #include using namespace std; typedef long long LL; const int N = 200; string sta[N * N]; int n, sx, sy, tx, ty, top; int f[N][N][2]; char fr[N][N][20 * N]; const int dx[] = {2, 2, 0, -2, -2, 0}; const int dy[] = {1, -1, -2, -1, 1, 2}; void get_ans(int x){ cout << x << endl; for(; x; x --){ switch(fr[tx][ty][x]){ case 0: cout << "UL ";break; case 1: cout << "UR ";break; case 2: cout << "R ";break; case 3: cout << "LR ";break; case 4: cout << "LL ";break; case 5: cout << "L ";break; } int ttx = tx - dx[fr[tx][ty][x]]; int tty = ty - dy[fr[tx][ty][x]]; tx = ttx, ty = tty; } exit(0); } int main(){ int i, j, k, h; scanf("%d%d%d", &n, &sx, &sy); memset(f, -1, sizeof(f)); scanf("%d%d", &tx, &ty); swap(sx, tx), swap(sy, ty); f[sx][sy][0] = 0; for(i = 1; i <= 4000; i ++){ for(j = 0; j < n; j ++){ for(k = 0; k < n; k ++){ f[j][k][i & 1] = -1; for(h = 0; h < 6; h ++){ int tx = j - dx[h], ty = k - dy[h]; if(tx >= 0&&tx < n&&ty >= 0&&ty < n&&f[tx][ty][(i & 1)^1] != -1&&(f[j][k][i & 1] == -1 || f[tx][ty][(i & 1)^1] + 1 < f[j][k][i & 1])){ f[j][k][i & 1] = f[tx][ty][(i & 1)^1] + 1; fr[j][k][i] = h; } } } } if(f[tx][ty][i & 1] != -1){ get_ans(i); break; } } puts("Impossible"); return 0; }