#include #include #include #include using namespace std; void print(int x) { if(x==0) { cout<<"UL "; } else if(x==1) { cout<<"UR "; } else if(x==2) { cout<<"R "; } else if(x==3) { cout<<"LR "; } else if(x==4) { cout<<"LL "; } else cout<<"L "; } void printShortestPath(int n,int x1,int y1,int x2,int y2) { int ans=0,t1,t2,i,j; vector v; t1=abs(x2-x1); t2=abs(y2-y1); if(t1%2==1) { cout<<"Impossible"; return; } while(x1!=x2||y1!=y2) { if(x2y1) //go right { v.push_back(1); ans++; y1++; x1-=2; t2--; t1-=2; } else //go left and then right { if(t1>=4) { v.push_back(0); v.push_back(1); ans+=2; x1-=4; t1-=4; } } } else if(x2>x1) //go down { if(y2y1) //go right { v.push_back(3); ans++; y1++; x1+=2; t2--; t1-=2; } else //go left and then right { if(t1>=4) { v.push_back(3); v.push_back(4); ans+=2; x1+=4; t1-=4; } } } else { if(t2%2==1) { cout<<"Impossible"; return; } if(y2>y1) // go right { v.push_back(2); y1+=2; t2-=2; ans++; } else if(y2> 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; }