#include #include #include #include #include #include #include #include #include using namespace std; bool a[200][200] ; string str[200][200] ; int n ; int xi,yi,xf,yf ; int sp = INT_MAX ; string res = "" ; string as[] = { "UL" , "UR" , "R" , "LR" , "LL" , "L" } ; int ap[6][2] = { {-2,-1} , {-2,1} , {0,2} , {2,1} , {2,-1} , {0,-2} } ; /** void solve( int xi , int yi , int m , string s ) { if( xi == xf && yi == yf && m < sp ) { sp = m ; res = s.substr( 1 , s.length()-1 ) ; return ; } for( int i = 0 ; i < 6 ; i++ ) { int xt = xi + ap[i][0] ; int yt = yi + ap[i][1] ; if( xt >= 0 && yt >= 0 && xt < n && yt < n && a[xt][yt] == 0 ) { a[xt][yt] = 1 ; solve( xt , yt , m+1 , s+" "+as[i] ) ; a[xt][yt] = 0 ; } } } **/ int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ //fill( str , str + 40000 , "" ) ; cin >> n ; cin >> xi >> yi >> xf >> yf ; a[xi][yi] = 1 ; bool f(0) ; int dis(0) ; queue< pair< int,int > > q ; q.push( {xi,yi} ) ; while( !q.empty() && f == 0 ) { queue< pair< int,int > > t ; while( !q.empty() ) { int xt = q.front().first ; int yt = q.front().second ; q.pop() ; if( xt == xf && yt == yf && dis < sp ) { f = 1 ; sp = dis ; res = str[xt][yt] ; } for( int i = 0 ; i < 6 ; i++ ) { int xp = xt + ap[i][0] ; int yp = yt + ap[i][1] ; if( xp >= 0 && yp >= 0 && xp < n && yp < n && a[xp][yp] == 0 ) { t.push( {xp,yp} ) ; a[xp][yp] = 1 ; str[xp][yp] = str[xt][yt] + " " + as[i] ; } } } dis++ ; q = t ; } if( f == 1 ) cout << sp << "\n" << res.substr(1,res.length()-1) ; else cout << "Impossible\n" ; return 0; }