#include using namespace std; struct cell { int x, y; int dis; cell() {} cell(int x, int y, int dis) : x(x), y(y), dis(dis) {} }; bool isInside(int x, int y, int N) { if (x >= 1 && x <= N && y >= 1 && y <= N) return true; return false; } int minStepToReachTarget(int N, int kx, int ky, int tx, int ty) { int dx[] = {-2, -1, 1, -1, 1, 2}; int dy[] = {0, -2, -2, 2, 2, 0}; queue q; q.push(cell(kx,ky, 0)); cell t; int x, y; bool visit[N + 1][N + 1]; for (int i = 1; i <= N; i++) for (int j = 1; j <= N; j++) visit[i][j] = false; visit[kx][ky] = true; while (!q.empty()) { t = q.front(); q.pop(); visit[t.x][t.y] = true; if (t.x == tx && t.y == ty) return t.dis; for (int i = 0; i < 6; i++) { x = t.x + dx[i]; y = t.y + dy[i]; if (isInside(x, y, N) && !visit[x][y]) q.push(cell(x, y, t.dis + 1)); } } return -1; } int main() { int n; cin >> n; int i_start; int j_start; int i_end; int j_end; cin >> i_start >> j_start >> i_end >> j_end; int t = minStepToReachTarget(n, i_start, j_start, i_end, j_end); if(t==-1) cout<<"Impossible"; else cout<