import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { // UL, UR, R, LR, LL, L static int[] dx={-2,-2,0,2,2,0}; static int[] dy={-1,1,2,1,-1,-2}; static String[] arr={"UL","UR","R","LR","LL","L"}; static class Node { int x,y,d; Node(int x,int y,int d) { this.x=x;this.y=y; this.d=d; } } static void printShortestPath(int n, int u, int v, int u1, int v1) { // Print the distance along with the sequence of moves. Queue queue=new LinkedList(); Stack st=new Stack(); queue.add(new Node(u,v,0)); int[][] par=new int[n][n]; int[][] x1=new int[n][n]; int[][] y1=new int[n][n]; int[][] dis=new int[n][n]; for(int i=0;i=0&&a1=0&&b1node.d+1) { x1[a1][b1]=node.x; y1[a1][b1]=node.y; par[a1][b1]=l; } dis[a1][b1]=Math.min(dis[a1][b1],node.d+1); queue.add(new Node(a1,b1,node.d+1)); } } } if(s==-1) { System.out.println("Impossible"); } } public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int i_start = in.nextInt(); int j_start = in.nextInt(); int i_end = in.nextInt(); int j_end = in.nextInt(); printShortestPath(n, i_start, j_start, i_end, j_end); in.close(); } }