#include //----- BUILTIN---------// #define cnt64(n) (__builtin_popcountll(unsigned long long(n))) #define clz64(n) (64-__builtin_clzll(unsigned long long(n))) #define ctz64(n) (__builtin_ctzll(unsigned long long(n))) #define cnt32(n) (__builtin_popcount(int(n))) #define clz32(n) (32-__builtin_clz(int(n))) #define ctz32(n) (__builtin_ctz(int(n))) //----- TOOLS ----------// #define fori(i,n,k) for (int i = int(k); (i) < int(n); ++(i)) #define forr(i,n,k) for (int i = int(n)-1; (i) >= int(k); --(i)) #define in_range(i,l,r) (bool)(l <= i&&i <= r) #define all(v) v.begin(), v.end() #define PI 3.14159265358979323846 #define INF (1<<30) #define MAXN 201 using namespace std; typedef long long int lli; int n, si, sj, fi, fj; struct node{ string nm; int x, y, v; }; node board[MAXN][MAXN]; int x[6] = {+0, -2, -2, +0, +2, +2}; int y[6] = {+2, +1, -1, -2, -1, +1}; string nm[6] = {"L", "LL", "LR", "R", "UR", "UL"}; inline bool is(int x, int y){ return (in_range(x, 0, n-1) && in_range(y, 0, n-1) && board[x][y].v == INF); } bool solve(){ fori(i, n, 0) fori(j, n, 0) board[i][j].v = INF; board[fi][fj].v = 0; int i, j, v; pair p; queue< pair > q; q.push(make_pair(fi, fj)); while(!q.empty()){ p = q.front(); q.pop(); i = p.first; j = p.second; v = board[i][j].v+1; if(i == si && j == sj){ cout << board[i][j].v << '\n'; while(i != fi || j != fj){ cout << board[i][j].nm << ' '; v = i; i = board[i][j].x; j = board[v][j].y; } cout << '\n'; return true; } fori(k, 6, 0){ if(is(i+x[k], j+y[k])){ board[i+x[k]][j+y[k]].v = v; board[i+x[k]][j+y[k]].x = i; board[i+x[k]][j+y[k]].y = j; board[i+x[k]][j+y[k]].nm = nm[k]; q.push(make_pair(i+x[k], j+y[k])); } } } return false; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); #ifndef __unix__ clock_t exc = clock(); //assert(freopen("input.txt", "r", stdin)); //assert(freopen("output.txt", "w", stdout)); #endif cin >> n; cin >> si >> sj >> fi >> fj; if(!solve()) cout << "Impossible\n"; #ifndef __unix__ cout << (double)(clock()-exc)/CLOCKS_PER_SEC*1000 << "ms.\n"; #endif return 0; }