#include using namespace std; #define pb(a) push_back(a) #define mp(a,b) make_pair(a,b) #define ll long long #define pii pair #define pll pair #define forr(a,b,c) for(int a=b;ac;a--) #define all(v) v.begin(),v.end() #define revall(v) v.rbegin(),v.rend() #define allk(v,k) v.begin()+k,v.end() #define revallk(v,k) v.rbegin()+k,v.rend() #define allkj(v,k,j) v.begin()+k,v.end()-j #define revallkj(v,k,j) v.rbegin()+j,v.rend()-k #define ff first #define ss second #define init inity #define y1 kjgkjy #define x1 kjvjkk ////////////////////////// non-modifiable ///////////////////////////////// #define mod 1000000007 #define eps 1e-9 #define inf INT_MAX #define infl LONG_LONG_MAX ll power(ll a,ll n) { if(a==0)return 0; if(a==1 || n==0)return 1; if(n==1)return a%mod;//can remove mod? ll t=power(a,n/2); t=t*t%mod; if(n&1)return t*a%mod; return t; } #define P (int)(2e6)+9 #define FACTORIZE 1 #define DETERMINE 2 /*int primes[P]; void sieve(int prime=2)//2->detects prime, 1->max prime in factorization { forr(i,2,P-3) { if(!primes[i]) for(int j=prime*i;j0;idx-=idx&-idx) { sum+=tree[idx]; //sum%=mod; } return sum; } ////////////////////////// MODIFIABLE ///////////////////////////////////// struct node2 { int id,val; node2() { static int ctx=0; id=ctx++; }; node2(int a,int b=0,int c=0,int d=0,int e=0,int f=0) { val=a; } }; struct comp2 { bool operator()(int a,int b) { //return a s[N][N]; node top; bool h[N][N]; queue q; //int x[] = {-1,1,2,1,-1,-2}; //int y[] = {-2,-2,0,2,2,0}; string dir[] = {"UL","UR","R","LR","LL","L"}; int x[] = {-1,1,2,1,-1,-2}; int y[] = {-2,-2,0,2,2,0}; //vector s; double e,f,z; vector v, vec; set sett; typedef map Mapp; Mapp mapp; ////////////////////////// variable declarations ////////////////////////// void print()//for detailed output of [a data structure] { } void print2()//for detailed output of [a data structure] { } void input() { ios_base::sync_with_stdio(false);cin.tie(NULL); cin >> n >> y1 >> x1 >> y2 >> x2; y1++; x1++; y2++; x2++; } inline bool check(node top, int idx) { int yy = top.y + y[idx]; int xx = top.x + x[idx]; return yy > 0 && yy <= n && xx > 0 && xx <= n && h[yy][xx] == false; } void solve() { q.push( node( y1, x1, 0 ) ); s[y1][x1] = mp(node(0,0),string("")); h[y1][x1] = true; while( !q.empty() ) { top = q.front(); q.pop(); if( top.y == y2 && top.x == x2 ) { cout << top.len << endl; pair cur = s[top.y][top.x]; while( cur.ss != "" ) { v.pb(cur.ss); cur = s[cur.ff.y][cur.ff.x]; } forrev(i,v.size()-1,-1) cout << v[i] << " "; return; } forr(i,0,6) { if( check(top,i) ) { s[top.y+y[i]][top.x+x[i]] = mp( top, dir[i] ); q.push( node( top.y+y[i], top.x+x[i], top.len+1 ) ); h[top.y+y[i]][top.x+x[i]] = true; } } } cout << "Impossible"; } void output() { } ///////////////////////////// my functions //////////////////////////////// int main() { input(); solve(); output(); return 0; } //// MAIN //// MAIN //// MAIN //// MAIN //// MAIN //// MAIN //// MAIN ////