#include using namespace std; int isReachable(int row1, int row2, int col1, int col2) { // check whether the destination is still reachable. int rowdif = abs(row2-row1), coldif = abs(col2-col1); if(rowdif==0 && coldif&1) { //puts("Impossible"); return 0; } else if(coldif==0 && (rowdif&1)) { //puts("Impossible"); return 0; }else { if(rowdif&1) { //puts("Impossible"); return 0; } coldif-=rowdif/2; if(coldif&1) { //puts("Impossible"); return 0; } } return 1; } int dis(int row1, int row2, int col1, int col2) { // distance that will is still required to move. int ans=0, rowdif = abs(row2-row1), coldif = abs(col2-col1); if(coldif==0) { ans= rowdif/2; } else if(rowdif==0) { ans= coldif/2; } else { ans+=rowdif/2; ans+=(coldif-ans)/2; } return ans; } pair moveDown(int row1, int row2, int col1, int col2, vector &p) { if(col1<=col2) { p.push_back("LR"); row1+=2;col1+=1; }else { p.push_back("LL"); row1+=2;col1-=1; } pair point=make_pair(row1, col1); return point; } pair moveUp(int row1, int row2, int col1, int col2, vector &p) { if(col1>=col2) { p.push_back("UL"); row1-=2;col1-=1; }else { p.push_back("UR"); row1-=2;col1+=1; } pair point=make_pair(row1, col1); return point; } int isReached(int row1, int row2, int col1, int col2) { if(row1==row2 && col1==col2) return 1; else return 0; } int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ int n; scanf("%d", &n); int row1, col1, row2, col2, ans=0; vector path; cin>>row1>>col1>>row2>>col2; if(!isReachable(row1, row2, col1, col2)) { puts("Impossible"); return 0; } else { ans=dis(row1, row2, col1, col2); while(!(row1==row2 && col1==col2)) { if(row2>row1) { pair point=moveDown(row1, row2, col1, col2, path); row1=point.first; col1=point.second; //cout<<"after movind down: "< point=moveUp(row1, row2, col1, col2, path); row1=point.first; col1=point.second; //cout<<"after movind up: "<col1) { for(int kk=0;kk