import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.LinkedList; import java.util.Queue; //UL, UR, R, LR, LL, L class codesprint1 { static boolean b[][]; static int rowNum[] = {-2, -2, 0, 2, 2, 0}, colNum[] = {-1, 1, 2, 1, -1, -2},n; static String str[] = {"UL ", "UR ", "R ", "LR ", "LL ", "L "}; public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); n = Integer.parseInt(in.readLine()); String s[] = in.readLine().split(" "); int i_start = Integer.parseInt(s[0]); int j_start = Integer.parseInt(s[1]); int i_end = Integer.parseInt(s[2]); int j_end = Integer.parseInt(s[3]); b = new boolean[n][n]; BFS(new Point(i_start,j_start),new Point(i_end,j_end)); in.close(); } public static void BFS(Point src, Point dest) { boolean visited[][] = new boolean[n][n]; visited[src.x][src.y] = true; Queue q = new LinkedList<>(); Nodex s = new Nodex(0, "", src); q.add(s); while (!q.isEmpty()) { Nodex curr = q.poll(); Point pt = curr.z; if (pt.x == dest.x && pt.y == dest.y) { System.out.println(curr.x + "\n" + curr.y); return; } for (int i = 0; i < 6; i++) { int row = pt.x + rowNum[i]; int col = pt.y + colNum[i]; if (isValid(row, col) && !visited[row][col]) { visited[row][col] = true; Nodex Adjcell = new Nodex(curr.x + 1, curr.y + str[i], new Point(row, col)); q.add(Adjcell); } } } System.out.println("Impossible"); } private static boolean isValid(int row, int col) { // return true if row number and column number // is in range return (row >= 0) && (row < n) && (col >= 0) && (col < n); } } class Nodex { int x;String y;Point z; Nodex(int x,String y,Point z){ this.x=x; this.y=y; this.z=z; } } class Point { int x,y; Point(int x,int y) { this.x=x; this.y=y; } }