#include using namespace std; //UL, UR, R, LR, LL, L int x[6][2] = {{-2,-1},{-2,1},{0,2},{2,1},{2,-1},{0,-2}}; string find(int a, int b) { if(a==-2) { if(b==-1) { return "UL"; } else { return "UR"; } } else if(a==0) { if(b==2) { return "R"; } else { return "L"; } } else { if(b==1) { return "LR"; } else { return "LL"; } } return NULL; } void printShortestPath(int n, int a, int b, int c, int d) { queue> q; pair p,p1; p = make_pair(a,b); q.push(p); map, int> m; map,pair> parent; m[p] = 0; vector> visited(n,vector(n,false)); bool d1 = false; int a1,a2,b1,b2,i; while(!q.empty()) { p = q.front(); a1 = p.first; a2 = p.second; if(a1==c && a2==d) { d1 = true; break; } //visited[a1][a2] = true; for(i=0;i<6;i++) { b1 = a1+x[i][0]; b2 = a2+x[i][1]; p1 = make_pair(b1,b2); if(b1>=0 && b1=0 && b2 r; if(!d1) { cout<<"Impossible"< s; while(p!=p1) { r = parent[p]; s.push(find(p.first - r.first,p.second - r.second)); p = r; } while(!s.empty()) { cout<> n; int i_start; int j_start; int i_end; int j_end; cin >> i_start >> j_start >> i_end >> j_end; printShortestPath(n, i_start, j_start, i_end, j_end); return 0; }