import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int rowStart = in.nextInt(); int colStart = in.nextInt(); int rowEnd = in.nextInt(); int colEnd = in.nextInt(); String impossible = "Impossible"; if (rowStart == rowEnd) { int colDiff = colStart - colEnd; int colDiffAbs = Math.abs(colDiff); int remain = colDiffAbs % 2; if (remain == 0) { int result = colDiffAbs / 2; System.out.println(result); if (colDiff != 0) { String string = colDiff < 0 ? "L" : "R"; for (int i = 1; i < result; i++) { string = string.concat(" ").concat(string); } System.out.println(string); } } else { System.out.println(impossible); } } else { int rowDiff = rowStart - rowEnd; int rowDiffAbs = Math.abs(rowDiff); int remain = rowDiffAbs % 2; if (remain == 0) { int rowCheck = (rowDiffAbs / 2) % 2; int colDiff = colStart - colEnd; int colDiffAbs = Math.abs(colDiff); int colRemain = colDiffAbs % 2; if (colRemain == rowCheck) { printShortestPath(n, rowStart, colStart, rowEnd, colEnd, "", 0); } else { System.out.println(impossible); } } else { System.out.println(impossible); } } in.close(); } private static void printShortestPath(int n, int rowStart, int colStart, int rowEnd, int colEnd, String string, int mov) { if (rowStart == rowEnd && colStart == colEnd) { System.out.println(mov); if (string.startsWith(" ")) { string = string.substring(1); } System.out.println(string); return; } int newRow = rowStart - 2; int newCol = colStart - 1; boolean proceed = proceed(n, newRow, newCol, rowStart, colStart, rowEnd, colEnd); if (proceed) { ++mov; string = string.concat(" ").concat("UL"); printShortestPath(n, newRow, newCol, rowEnd, colEnd, string, mov); } else { newRow = rowStart - 2; newCol = colStart + 1; proceed = proceed(n, newRow, newCol, rowStart, colStart, rowEnd, colEnd); if (proceed) { ++mov; string = string.concat(" ").concat("UR"); printShortestPath(n, newRow, newCol, rowEnd, colEnd, string, mov); } else { newRow = rowStart; newCol = colStart + 2; proceed = proceed(n, newRow, newCol, rowStart, colStart, rowEnd, colEnd); if (proceed) { ++mov; string = string.concat(" ").concat("R"); printShortestPath(n, newRow, newCol, rowEnd, colEnd, string, mov); } else { newRow = rowStart + 2; newCol = colStart + 1; proceed = proceed(n, newRow, newCol, rowStart, colStart, rowEnd, colEnd); if (proceed) { ++mov; string = string.concat(" ").concat("LR"); printShortestPath(n, newRow, newCol, rowEnd, colEnd, string, mov); } else { newRow = rowStart + 2; newCol = colStart - 1; proceed = proceed(n, newRow, newCol, rowStart, colStart, rowEnd, colEnd); if (proceed) { ++mov; string = string.concat(" ").concat("LL"); printShortestPath(n, newRow, newCol, rowEnd, colEnd, string, mov); } else { newRow = rowStart; newCol = colStart - 2; ++mov; string = string.concat(" ").concat("L"); printShortestPath(n, newRow, newCol, rowEnd, colEnd, string, mov); } } } } } } private static boolean proceed(int n, int newRow, int newCol, int rowStart, int colStart, int rowEnd, int colEnd) { if (newRow < 0 || newRow >= n || newCol < 0 || newCol >= n) { return false; } else { int newPosDiff = Math.abs(newRow - rowEnd) + Math.abs(newCol - colEnd); int posDiff = Math.abs(rowStart - rowEnd) + Math.abs(colStart - colEnd); return (newPosDiff < posDiff && posDiff > 3) || newPosDiff == 0; } } }