#include using namespace std; #define mod 1000000007 #define MAX 1000000000000000 #define all(v) v.begin(),v.end() #define rep(i,a,b) for(i=(ll)a;i<(ll)b;i++) #define revrep(i,a,b) for(i=(ll)a;i>=(ll)b;i--) #define ii pair #define MP make_pair #define pb push_back #define f first #define se second #define ll long long int #define vi vector ll modexp(ll a,ll b){ ll res = 1; while(b > 0){ if(b & 1) res = (res * a); a = (a * a); b/=2; } return res; } #define rs resize long long readLI(){ register char c; for(c = getchar(); !(c>='0' && c<='9'); c = getchar()); register long long a=c-'0'; for(c = getchar(); c>='0' && c<='9'; c = getchar()) a = (a<<3)+(a<<1)+c-'0'; return a; } const ll N = 509; ll n,i,j,x11,x12,y11,y12,a,b,x,y,d; ll di[N][N],m[N][N]; bool visit[N][N]; ll dx[] = {-2,-2,0,2,2,0},dy[] = {-1,1,2,1,-1,-2}; queue q; int main() { std::ios_base::sync_with_stdio(false); cin.tie(NULL); cin>>n>>x11>>y11>>x12>>y12; rep(i,0,n) rep(j,0,n) di[i][j] = MAX,m[i][j] = -1; di[x11][y11] = m[x11][y11] = 0; q.push({x11,y11}); while(!q.empty()){ ii u = q.front(); q.pop(); a = u.f; b = u.se; if(visit[a][b]) continue; visit[a][b] = true; rep(i,0,6){ x = a + dx[i]; y = b + dy[i]; if(x >= 0 and y >= 0 and x < n and y < n and di[x][y] > di[a][b] + 1){ di[x][y] = di[a][b] + 1; q.push({x,y}); m[x][y] = i + 1; } } } x = x12; y = y12; if(!visit[x][y]) cout<<"Impossible"; else{ stack s; cout<