import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { private static class Point{ int x; int y; public Point(int x, int y) { this.x = x; this.y = y; } } static void printShortestPath(int n, int i_start, int j_start, int i_end, int j_end) { String [][] code = new String[n][n]; Point [][] prev = new Point[n][n]; code[i_start][j_start] = ""; Queue queue = new LinkedList<>(); queue.add(new Point(i_start, j_start)); while (!queue.isEmpty()) { Point point = queue.poll(); checkAndAdd(code, queue, point.x-2, point.y-1, n, "UL", point, prev); checkAndAdd(code, queue, point.x-2, point.y+1, n, "UR", point, prev); checkAndAdd(code, queue, point.x, point.y+2, n, "R", point, prev); checkAndAdd(code, queue, point.x+2, point.y+1, n, "LR", point, prev); checkAndAdd(code, queue, point.x+2, point.y-1, n, "LL", point, prev); checkAndAdd(code, queue, point.x, point.y-2, n, "L", point, prev); } if (code[i_end][j_end] == null) { System.out.println("Impossible"); } else { ArrayList result = new ArrayList<>(); int i = i_end; int j = j_end; while(!(i == i_start && j == j_start)){ result.add(code[i][j]); Point point = prev[i][j]; i = point.x; j = point.y; } System.out.println(result.size()); for (int ii = result.size()-1;ii >= 0; ii--) { System.out.print(result.get(ii) + " "); } } } private static void checkAndAdd(String[][] code, Queue queue, int x, int y, int n, String move, Point point, Point[][] points) { if (x<0 || x>= n){ return; } if (y<0 || y>= n){ return; } if (code[x][y] != null){ return; } code[x][y] = move; queue.add(new Point(x,y)); points[x][y] = point; } 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(); } }