import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { 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. int di = i_start-i_end; int dj = j_start -j_end; boolean imposs = false; if(di%4 == 3 || di%4 == 1) imposs = true; if(di%4 == 2 && ((dj%4 == 0) || (dj%4 == 2))) imposs = true; if(di%4 == 0 && ((dj%4 == 1) || (dj%4 == 3))) imposs = true; if(imposs) System.out.print("Impossible"); else{ LinkedList list = new LinkedList(); while((i_start != i_end) || (j_start != j_end)){ if((i_start > i_end) && (j_start >= j_end)&& (i_start-2 >= 0) && (j_start-1 >= 0)){ list.add("UL"); i_start = i_start -2; j_start--; } else{ if((i_start > i_end) && (j_start <= j_end)&& (i_start-2 >= 0) && (j_start+1 < n)){ list.add("UR"); i_start = i_start -2; j_start++; } else{ if((i_start == i_end) && (j_start < j_end)&& (j_start+2 < n)){ list.add("R"); j_start = j_start +2; } else{ if((i_start < i_end) && (j_start <= j_end)&& (i_start+2 < n) && (j_start+1 < n)){ list.add("LR"); i_start = i_start +2; j_start++; } else{ if((i_start < i_end) && (j_start >= j_end)&& (i_start+2 < n) && (j_start-1 >= 0)){ list.add("LL"); i_start = i_start +2; j_start--; } else{ if((i_start == i_end) && (j_start > j_end)&& (j_start-2 >= 0)){ list.add("L"); j_start=j_start-2; } else{ System.out.print("Impossible"); imposs = true; break; } } } } } } } if (!imposs){ System.out.println(list.size()); String[] arr = list.toArray(new String[list.size()]); for(int j=0; j