import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; class Cell { int row, col, dis; String sequenzaMosse; public Cell(int row, int col, int dis, String sequenzaMosse) { this.row = row; this.col = col; this.dis = dis; this.sequenzaMosse = sequenzaMosse; } } public class Solution { static boolean isInside(int x, int y, int N) { if (x >= 0 && x < N && y >= 0 && y < N) return true; return false; } 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. // x and y direction, where a knight can move int dCol[] = {1, 2, 1, -1, -2, -1}; int dRow[] = {2, 0, -2, -2, 0, 2}; String mossa[] = {"LR", "R", "UR", "UL", "L", "LL"}; Queue q = new LinkedList<>(); q.add(new Cell(i_start, j_start, 0, "")); Cell t; int row, col; boolean visit[][] = new boolean[n][n]; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { visit[i][j] = false; } } visit[i_start][j_start] = true; while (!q.isEmpty()) { t = q.remove(); visit[t.row][t.col] = true; if (t.row == i_end && t.col == j_end) { System.out.println(t.dis + "\n" + t.sequenzaMosse); return; } for (int i = 0; i < 6; i++) { col = t.col + dCol[i]; row = t.row + dRow[i]; if (isInside(row, col, n) && !visit[row][col]) { q.add(new Cell(row, col, t.dis + 1, t.sequenzaMosse + mossa[i] + " ")); } } } System.out.println("Impossible"); } 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(); } }