import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static int[][] array; static String shortestPath; static int shortestInt; static int arrayLength; static void printShortestPath(int n, int i_start, int j_start, int i_end, int j_end) { // Print the distance along with the sequence of moves. arrayLength = n; if(i_start<0||j_start<0||i_end<0||j_end<0||i_start>=n||j_start>=n||i_end>n||j_end>=n) { System.out.println("Impossible"); } else { array = new int[n][n]; for(int i = 0;i0) { System.out.println(shortestInt); System.out.println(shortestPath); } else { System.out.println("Impossible"); } } } public static void shortCalc(int step, String path, int i_start, int j_start, int i_end, int j_end) { if(i_start<0||j_start<0||i_end<0||j_end<0||i_start>=arrayLength||j_start>=arrayLength||i_end>=arrayLength||j_end>=arrayLength) { return; } if(step>array[i_start][j_start]) { return; } else { if(i_start==i_end&&j_start==j_end) { if(step==array[i_start][j_start]) { Scanner scan1 = new Scanner(shortestPath); Scanner scan2 = new Scanner(path); for(int i = 0;ispStringInt) { return; } else if(pStringInt