#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. string s[] = {"UL", "UR", "R", "LR", "LL", "L"}; vector v; int stepNum = 0; int stepX = i_start, stepY = j_start; if((i_end-i_start)%2!=0) { cout << "Impossible"; return; } while(1) { if(stepX>=n || stepY>=n || stepX<0 || stepY<0) { cout << "Impossible"; return; } if(stepX==i_end && stepY==j_end) { break; } if((i_end-stepX)==0 && (j_end-stepY)>0) { v.push_back(2); stepY += 2; stepNum++; continue; } if((i_end-stepX)==0 && (j_end-stepY)<0) { v.push_back(5); stepY -= 2; stepNum++; continue; } if((i_end-stepX)<=0 && (j_end-stepY)<=0) { v.push_back(0); stepX -= 2; stepY -= 1; stepNum++; continue; } if((i_end-stepX)<=0 && (j_end-stepY)>=0) { v.push_back(1); stepX -= 2; stepY += 1; stepNum++; continue; } if((i_end-stepX)>=0 && (j_end-stepY)>=0) { v.push_back(3); stepX += 2; stepY += 1; stepNum++; continue; } if((i_end-stepX)>=0 && (j_end-stepY)<=0) { v.push_back(4); stepX += 2; stepY -= 1; stepNum++; continue; } } cout << stepNum << endl; for(int k=0; k> 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; }