import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static String function(int n, int i_start, int j_start, int i_end, int j_end){ int count=0; String s=""; while(true) { if(i_start!=i_end && j_start!=j_end) { if(i_start>i_end && j_start >j_end) { if(i_start-2>=i_end && j_start-1>=j_end) { s=s+"UL "; count++; i_start=i_start-2; j_start=j_start-1; } else return "-1"; } else if(i_start>i_end && j_start =i_end && j_start+1<=j_end) { count++; s=s+"UR "; i_start=i_start-2; j_start=j_start+1; } else return "-1"; } else if(i_startj_end) { if(i_start+2<=i_end && j_start-1>=j_end) { count++; s=s+"LL "; i_start=i_start+2; j_start=j_start-1; } else return "-1"; } } else if(i_start==i_end && j_start==j_end) { System.out.println(count); return s; } else if(i_start==i_end && j_start!=j_end) { if(j_startj_end && j_start-2>=j_end) { s=s+"L "; count++; j_start=j_start-2; } else return "-1"; } else if(i_start!=i_end && j_start==j_end) { if(Math.abs(i_start-i_end)<=2) return "-1"; else if(Math.abs(i_start-i_end)%2==0) { if(i_start>i_end) { if(i_start-2>=i_end && j_start-1>=j_end) { s=s+"UL "; count++; i_start=i_start-2; j_start=j_start-1; } else if(i_start-2>=i_end && j_start+1<=j_end) { count++; s=s+"UR "; i_start=i_start-2; j_start=j_start+1; } else return "-1"; } else { if(i_start+2<=i_end && j_start+1<=n-1) { count++; s=s+"LR "; i_start=i_start+2; j_start=j_start+1; } else if(i_start+2<=i_end && j_start+1<=n-1) { count++; s=s+"LL "; i_start=i_start+2; j_start=j_start+1; } else return "-1"; } } else return "-1"; } } } 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. String r; r=function(n,i_start,j_start,i_end,j_end); if(r.equals("-1")) System.out.println("Impossible"); else { StringTokenizer t=new StringTokenizer(r," "); int count[]=new int[6]; for(int k=0;k<6;k++) count[k]=0; while(t.hasMoreTokens()) { switch(t.nextToken()) { case "UL": count[0]++; break; case "UR": count[1]++; break; case "R": count[2]++; break; case "LR": count[3]++; break; case "LL": count[4]++; break; case "L": count[5]++; break; } } for(int k=0;k