#include using namespace std; #define ll long long int vector > visited(2009,vector (2009,false)); vector > dist(2009,vector(2009,INT_MAX)); vector > path(2009,vector(2009,-1)); int dx[] = {-2,-2,0,2,2,0}; int dy[] = {-1,1,2,1,-1,-2}; void printPath(int is,int js,int ie,int je) { if(is==ie && js==je)return; int dir = path[ie][je]; if(dir==-1)return; if(dir==6) { //cout << "1 "; //cout << "L "; printPath(is,js,ie,je+2); cout << "L "; } if(dir==1) { //cout << "2 "; //cout << "UL "; printPath(is,js,ie+2,je+1); cout << "UL "; } if(dir==2) { //cout << "3 "; //cout << "UR "; printPath(is,js,ie+2,je-1); cout << "UR "; } if(dir==3) { //cout << "4 "; //cout << "R "; printPath(is,js,ie,je-2); cout << "R "; } if(dir==4) { //cout << "5 "; //cout << "LR "; printPath(is,js,ie-2,je-1); cout << "LR "; } if(dir==5) { //cout << "6 "; //cout << "LL "; printPath(is,js,ie-2,je+1); cout << "LL "; } } int main () { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); ll n,is,js,ie,je; cin >> n >> is >> js >> ie >> je; queue > q; q.push({is,js}); dist[is][js] = 0; while(!q.empty()) { pair pr; pr = q.front(); q.pop(); int i,j; i = pr.first; j = pr.second; visited[i][j] = true; if(ie==i && je==j)break; for(int z=0;z<6;z++) { int k,l; k = i+dx[z]; l = j+dy[z]; if(k>=0 && k=0 && ldist[i][j]+1) { q.push({k,l}); dist[k][l] = dist[i][j]+1; path[k][l] = z+1; } } } } } if(dist[ie][je]>=INT_MAX)cout << "Impossible"; else { cout << dist[ie][je] << endl; printPath(is,js,ie,je); } return 0; }