#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((i_start%2==0&&i_end%2==1)||(i_start%2==1&&i_end%2==0)) {cout<<"Impossible";return;} if(i_start==i_end) { if(j_start>j_end) { if(((j_start-j_end)%4)!=0) {cout<<"Impossible";return;} } if(((j_end-j_start)%4)!=0) {cout<<"Impossible";return;}} */ int count=0; int ops[1000]; int curr=0; start: if(count>=1000) {cout<<"Impossible";return;} if(i_start==i_end&&j_start==j_end) goto print; if(i_start>i_end&&j_start>=j_end) {ops[curr++]=1; i_start-=2;j_start-=1;count++;} else if(i_start>i_end&&j_startj_end) {ops[curr++]=5;i_start+=2;j_start-=1;count++;} else if(j_startj_end) {ops[curr++]=6;j_start-=2;count++;} goto start; print: 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; }