#include using namespace std; /* (i-2,j-1) (i-2,j+1) (i ,j+2) (i+2,j+1) (i+2,j-1) (i ,j-2) */ 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 distance=-1,chess[n][n],start,end,pos1,pos2,c=0,f=0; int i,j; char knight; string moves[10]; start=chess[i_start][j_start]=1; end=chess[i_end][j_end]=9; pos1=i_start-i_end; pos2=j_start-j_end; // cout<<"pos 1: "<10) { cout<<"Impossible"; exit(0); } } while(i!=i_end && j!=j_end) { c++; //cout<<"dd"; while((pos1>0 && pos2>0) && i!=i_end) { i=i-2; j=j-1; // cout<<"i is "<0) && i!=i_end) { i=i-2; j=j+1; // cout<<"i is "<10) { cout<<"Impossible"; exit(0); } // cout<<"i is "<> 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; }