import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { 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. int board[][] = new int[n][n]; boolean[][] visited = new boolean[n][n]; board[i_start][j_start] = -1; int moves[][] = new int[][]{{-2, -1}, {-2, 1}, {0, 2}, {2, 1}, {2, -1}, {0, -2}}; LinkedList list = new LinkedList(); list.add(i_start * n + j_start); visited[i_start][j_start] = true; while(!list.isEmpty()){ int v = list.poll(); int s_i = v / n; int s_j = v % n; if(s_i == i_end && s_j == j_end) break; for(int i = 0; i < 6; i++){ int newI = s_i + moves[i][0]; int newJ = s_j + moves[i][1]; if(newI >= 0 && newI < n && newJ >= 0 && newJ < n && !visited[newI][newJ]){ list.add(newI * n + newJ); visited[newI][newJ] = true; board[newI][newJ] = i; } } } if(visited[i_end][j_end]){ ArrayList path = new ArrayList(); int i = i_end, j = j_end; while(board[i][j] != -1){ switch(board[i][j]){ case 0: path.add("UL"); break; case 1: path.add("UR"); break; case 2: path.add("R"); break; case 3: path.add("LR"); break; case 4: path.add("LL"); break; case 5: path.add("L"); break; } int index = board[i][j]; i -= moves[index][0]; j -= moves[index][1]; } System.out.println(path.size()); for(i = path.size(); i > 0; i--) System.out.print(path.get(i - 1) + " "); System.out.println(); }else 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(); } }