#include using namespace std; void printShortestPath(int n, int i_start, int j_start, int i_end, int j_end) { // Print the distance along with the sequence of moves. int dr,dc,ans=0,z=0,imp=0; char x,y,str[20]; dr=abs(i_start-i_end); dc=abs(j_start-j_end); if(dr==0 && dc==0) cout<<'0'; /*if(i_start-i_end<0) x='L'; else x='U'; if(j_start-j_end<0) y='R'; else y='L';*/ while(dr>0 || dc>0){ if(i_start-i_end<0) x='L'; else x='U'; if(j_start-j_end<0) y='R'; else y='L'; if(dc==0){ if(dr%4==0){ str[z]=x;z++;y='R'; str[z]=y;z++; str[z]=' ';z++; ans++; dr=dr-2; i_start=abs(i_start-dr); dc++; j_start=abs(j_start+dc); } else{ cout<<"Impossible"; dr=0;dc=0;imp=1;} } else if(dr==0){ if(dc%2==0){ str[z]=y;z++; ans++; dc=dc-2; j_start=abs(dc-j_start); } else{ cout<<"Impossible"; dr=0;dc=0;imp=1;} } else if(dr>=2 && dc>=0){ dr=dr-2; dc=dc-1; i_start=abs(dr-i_start); j_start=abs(dc-j_start); str[z]=x;z++; str[z]=y;z++; str[z]=' ';z++; ans++; } else{ cout<<"Impossible"; dr=0;dc=0;imp=1;} } if(imp==0){ 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; }