#include using namespace std; #define vi vector < int > #define pii pair < int , int > #define vvi vector #define pb push_back #define mp make_pair #define ff first #define ss second #define foreach(it,v) for( __typeof((v).begin())it = (v).begin() ; it != (v).end() ; it++ ) #define ll long long #define llu unsigned long long #define MOD 1000000007 #define INF 0x3f3f3f3f #define dbg(x) { cout<< #x << ": " << (x) << endl; } #define dbg2(x,y) { cout<< #x << ": " << (x) << " , " << #y << ": " << (y) << endl; } #define all(x) x.begin(),x.end() #define mset(x,v) memset(x, v, sizeof(x)) #define sz(x) (int)x.size() #define s(a) scanf("%d",&a) #define sl(a) scanf("%lld",&a) ll gcd(ll a, ll b) {if (a == 0 || b == 0) return max(a,b); if (b % a == 0) return a; return gcd(b%a, a);} ll hcf(ll a, ll b) {if(b>a) return (hcf(b, a)); if(a%b==0) return b; return (hcf(b, a%b));} ll modpow(ll a,ll b) {ll res=1;a%=MOD;for(;b;b>>=1){if(b&1)res=res*a%MOD;a=a*a%MOD;}return res;} ll mulmod(ll a, ll b, ll m) {int64_t res = 0;while (a != 0){if(a & 1)res =(res+b)%m;a>>=1;b =(b<<1)%m;}return res;} int visited[205][205]; int possY[3] = {-2,0,2}; int possX[3] = {-1,0,1}; string findMinPath(int n,int x1, int y1, int x2,int y2) { queue, string>> BFS; BFS.push(mp(mp(x1,y1),"")); while(!BFS.empty()) { pair, string> curr = BFS.front(); BFS.pop(); int currX = curr.first.first; int currY = curr.first.second; string currPath = curr.second; if(currX == x2 && currY == y2) { return currPath; } if((currX-1)>=0 && (currY-2)>=0 && visited[currX-1][currY-2] <= 4) { visited[currX-1][currY-2]++; BFS.push(mp(mp(currX-1,currY-2),currPath + "0")); } if((currX+1)=0 && visited[currX+1][currY-2] <= 4) { visited[currX+1][currY-2]++; BFS.push(mp(mp(currX+1,currY-2),currPath + "1")); } if((currX+2)=0 && (currY+2)=0 && visited[currX-2][currY] <= 4) { visited[currX-2][currY]++; BFS.push(mp(mp(currX-2,currY),currPath + "5")); } } return "Impossible"; } int main() { int n,x1,y1,x2,y2; s(n); s(x1);s(y1);s(x2);s(y2); string path = findMinPath(n,y1,x1,y2,x2); if(path == "Impossible") { cout << path << endl; } else { cout << path.length() << endl; for(int i=0;i