import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static Queue points = new LinkedList<>(); static int[][] dp; static String[][] paths; static int i_end; static int j_end; static void printShortestPath(int n, int i_start, int j_start, int i_end, int j_end) { if (i_start == i_end && j_start == j_end) { return; } Solution.i_end = i_end; Solution.j_end = j_end; dp = new int[n][]; for (int i = 0; i < n; i++) { dp[i] = new int[n]; for (int j = 0; j < n; j++) { dp[i][j] = Integer.MAX_VALUE; // if (i == i_start && j == j_start) { // System.out.print(" (start) "); // } else if (i == i_end && j == j_end) { // System.out.print(" (end) "); // } else { // System.out.print("(i=" + i + " j=" + j + ") "); // } } // System.out.println(); } paths = new String[n][]; for (int i = 0; i < n; i++) { paths[i] = new String[n]; for (int j = 0; j < n; j++) { paths[i][j] = ""; } } points.add(new Point(i_start, j_start, 0, "")); while (!points.isEmpty()) { // System.out.println(points.size()); Point point = points.poll(); int newStep = point.step + 1; checkNextPoint(n, new Point(point.i - 2, point.j - 1, newStep, point.path + "UL ")); checkNextPoint(n, new Point(point.i - 2, point.j + 1, newStep, point.path + "UR ")); checkNextPoint(n, new Point(point.i, point.j + 2, newStep, point.path + "R ")); checkNextPoint(n, new Point(point.i + 2, point.j + 1, newStep, point.path + "LR ")); checkNextPoint(n, new Point(point.i + 2, point.j - 1, newStep, point.path + "LL ")); checkNextPoint(n, new Point(point.i, point.j - 2, newStep, point.path + "L ")); // for (int i = 0; i < n; i++) { // for (int j = 0; j < n; j++) { // System.out.print("(" + i + "," + j + ")(" + paths[i][j] + ") "); // } // System.out.println(""); // } // System.out.println(); } String path = paths[i_end][j_end]; if (path.isEmpty()) { System.out.println("Impossible"); } else { System.out.println(path.split(" ").length); System.out.println(path); } } private static void checkNextPoint(int n, Point point) { if (point.i < n && point.i >= 0 && point.j < n && point.j >= 0) { if (point.step < dp[point.i][point.j]) { paths[point.i][point.j] = point.path; dp[point.i][point.j] = point.step; if (point.i != i_end && point.j != j_end) { points.add(point); } } } } static class Point { int i; int j; int step; String path; public Point(int i, int j, int step, String path) { this.i = i; this.j = j; this.step = step; this.path = path; } @Override public String toString() { return "Point{" + "x=" + i + ", y=" + j + ", step=" + step + '}'; } } public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int i_start = in.nextInt(); int j_start = in.nextInt(); int i_end = in.nextInt(); int j_end = in.nextInt(); printShortestPath(n, i_start, j_start, i_end, j_end); in.close(); } }