#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. if(abs(i_start-i_end)%2) cout<<"Impossible\n"; else{ string str = ""; int count = 0; int f=1; while(f){ if(j_start==j_end){ count += (abs(i_start-i_end)/2); int val = abs((i_start-i_end)/2); if(i_end > i_start){ while(val){ val -= 2; str += "LR LL "; } }else{ while(val){ val -= 2; str += "UL UR "; } } f = 0; } if(i_start==i_end && f){ if(abs(j_start-j_end)%2){ f = -1; break; }else{ int val = abs(j_start-j_end)/2; count +=val; if(j_start < j_end){ while(val){ val -=1; str += "R "; } }else{ while(val){ val -=1; str += "L "; } } } f = 0; } if(i_start < i_end && j_start < j_end){ str += "LR "; count += 1; i_start +=2; j_start +=1; }else if (i_start < i_end && j_start > j_end){ str += "LL "; count +=1; i_start +=2; j_start -=1; }else if (i_start > i_end && j_start < j_end){ str += "UR "; count +=1; i_start -=2; j_start +=1; }else if(i_start > i_end && j_start > j_end){ str += "UL "; count +=1; i_start -=2; j_start -=1; } } if(f==-1){ cout<<"Impossible\n"; }else{ 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; }