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. ArrayList arr = new ArrayList(); int i = i_start; int j = j_start; while(true){ if((j==j_end && i_end>=i-3 && i_end<=i+3) || ((i_end-i)%2!=0) || (i_start>i_end?ii_end)){ break; } int rowDiff = i-i_end; int colDiff = j-j_end; int row = rowDiff<0 ? -1*rowDiff : rowDiff; int col = colDiff<0 ? -1*colDiff : colDiff; if((rowDiff>=2) && (i-2>=0 && j-1>=0) && (row/2>col)){ arr.add("UL"); i += -2; j += -1; }else if((rowDiff>=2) && (colDiff<=-1) && (i-2>=0 && j+1col)){ arr.add("LR"); i += 2; j += 1; }else if((rowDiff<=-2) && (colDiff>=1) && (i+2=0)){ arr.add("LL"); i += 2; j += -1; }else if((rowDiff==0) && (colDiff>=2) && (j-2>=0)){ arr.add("L"); j += -2; } } if(i==i_end && j==j_end){ System.out.println(arr.size()); for(int l=0;l