import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static int[][] grid; static int getLength(String s) { if (s==null) return 0; String t[] = s.trim().split(" "); return t.length; } static String[] priority = {"UL", "UR", "R", "LR", "LL", "L"}; static String[] opposite = {"LR", "LL", "L", "UL", "UR", "R"}; static int getI(String s, int i) { switch (s) { case "UL":return i-2; case "UR":return i-2; case "R":return i; case "LR":return i+2; case "LL":return i+2; case "L":return i; default: return i; } } static int getJ(String s, int j) { switch (s) { case "UL":return j-1; case "UR":return j+1; case "R":return j+2; case "LR":return j+1; case "LL":return j-1; case "L":return j-2; default: return j; } } static String measureShortestPath(int n, int i_start, int j_start, int i_end, int j_end, int count) { if (i_start==i_end && j_start==j_end) return ""; count++; if (count>grid[i_start][i_end]) // overlapping - don't allow new paths with greater counts to continue return null; else grid[i_start][i_end]=count; // red knight considers its possible neighbor locations in the following order of priority: UL, UR, R, LR, LL, L. String minlen = null; for (int i=0; i=n || newj<0 || newj>=n) continue; // discard if x and y move away if (Math.pow(i_end-i_start,2)+Math.pow(j_end-j_start,2) < Math.pow(i_end-newi,2)+Math.pow(j_end-newj,2)) continue; String potentialPath = measureShortestPath(n, newi, newj, i_end, j_end, count); if (potentialPath != null) { String newpath = (priority[i] + " " + potentialPath).trim(); if (minlen==null || getLength(minlen)>getLength(newpath)) minlen=newpath; } } return minlen; } 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. grid[i_start][j_start]=0; String result = measureShortestPath(n, i_start, j_start, i_end, j_end, 0); if (result==null) System.out.println("Impossible"); else { System.out.println(getLength(result)); System.out.println(result); } } public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); grid = new int[n][n]; for (int i=0;i