#include #define MAX 10005 using namespace std; int abs(int s,int e) { if(s-e < 0) return 0-(s-e); else return (s-e); } int check(int si,int sj,int ei,int ej) { if(si == ei && sj == ej) return 1; else if((si == ei) && (sj+1 == ej || ej+1 == sj)) return 0; else if((sj == ej) && (si+1 == ei || ei+1 == si)) return 0; else if(abs(si,ei) == 1 && abs(sj,ej) == 1) return 0; else return 2; } int main() { int n,starti,startj,endi,endj,ans,arr[6][2]={-2,-1,-2,1,0,2,2,1,2,-1,0,-2},i,s,e,count=0,path[MAX],dist,dist1,si,ei,pos; char str[6][10]={"UL","UR","R","LR","LL","L"}; scanf("%d",&n); scanf("%d%d%d%d",&starti,&startj,&endi,&endj); while(1) { ans=check(starti,startj,endi,endj); if(ans != 2) break; dist=abs(starti,endi)+abs(startj,endj); for(i=0;i<6;i++) { s=starti+arr[i][0]; e=startj+arr[i][1]; dist1=abs(s,endi)+abs(e,endj); if(dist1 < dist) { si=s; ei=e; pos=i; dist=dist1; } } starti=si; startj=ei; path[count]=pos; count++; } if(ans == 0) printf("Impossible\n"); else { printf("%d\n",count); for(i=0;i