#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. //possible seq UL, UR, R, LR, LL, L vector ans; ///check for impossible if(abs(i_start-i_end)%2 == 1) { cout<<"Impossible"< i-2,j-1 /// UR -> i-2,j+1 /// R-> i,j+2 /// LR -> i+2, j+1 /// LL -> i+2,j-1 /// L -> i,j-2 if(i_start == i_end && j_end > j_start) { j_start += 2; ans.push_back("R"); continue; } if(i_start == i_end && j_end < j_start) { j_start -= 2; ans.push_back("L"); continue; } if(j_start == j_end && i_end < i_start) { //UL j_start -= 1; i_start -= 2; ans.push_back("UL"); continue; } if(j_start == j_end && i_end > i_start) { // cout<<"exe"<j_end && i_start> i_end) { //UL j_start -= 1; i_start -= 2; ans.push_back("UL"); continue; } if(j_start> j_end && i_start< i_end) { //LL i_start += 2; j_start -= 1; ans.push_back("LL"); } if(j_starti_end) { //UR i_start -= 2; j_start += 1 ; ans.push_back("UR"); } if(j_start > 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; }