#include #include #include #include #include #include #include int main() { int n; scanf("%i", &n); int i_start; int j_start; int i_end; int j_end; scanf("%i %i %i %i", &i_start, &j_start, &i_end, &j_end); int c=0,a[1000],k=0; while(i_start!=i_end||j_start!=j_end) { if((abs(j_start-j_end)==1&&i_start==i_end)||(abs(i_start-i_end)==1&&j_start==j_end)) { printf("Impossible"); exit(0); } if(i_start==i_end) { if(j_end>j_start) { j_start=j_start+2; c++; a[k++]=3; } else { j_start=j_start-2; c++; a[k++]=6; } } else { if(i_end>i_start) { if(j_start>j_end) { j_start=j_start-1; i_start=i_start+2; c++; a[k++]=5; } else { j_start=j_start+1; i_start=i_start+2; c++; a[k++]=4; } } else { if(j_start>j_end) { j_start=j_start-1; i_start=i_start-2; c++; a[k++]=1; } else { j_start=j_start+1; i_start=i_start-2; c++; a[k++]=2; } } } } printf("%d\n",c); for(int i=0;ia[j+1]) { int temp=a[j]; a[j]=a[j+1]; a[j+1]=temp; } } } for(int i=0;i