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. String[][] parent = new String[n][n]; Queue q = new LinkedList<>(); q.add(new int[]{i_start, j_start}); parent[i_start][j_start] = "start"; while(!q.isEmpty()){ int[] spot = (int[])q.remove(); int i = spot[0] - 2; int j = spot[1] - 1; if (i > -1 && j > -1 && parent[i][j] == null){ parent[i][j] = "UL"; q.add(new int[]{i, j}); } j += 2; if (i > -1 && j < n && parent[i][j] == null){ parent[i][j] = "UR"; q.add(new int[]{i, j}); } i += 2; j += 1; if (j < n && parent[i][j] == null){ parent[i][j] = "R"; q.add(new int[]{i, j}); } i += 2; j -= 1; if (i < n && j < n && parent[i][j] == null){ parent[i][j] = "LR"; q.add(new int[]{i, j}); } j -= 2; if (i < n && j > 0 && parent[i][j] == null){ parent[i][j] = "LL"; q.add(new int[]{i, j}); } i -= 2; j -= 1; if (j > 0 && parent[i][j] == null){ parent[i][j] = "L"; q.add(new int[]{i, j}); } } if (parent[i_end][j_end] == null){ System.out.println("Impossible"); return; } Stack s = new Stack(); boolean add = true; int[] last = new int[]{i_end, j_end}; while(add){ if (parent[last[0]][last[1]].equals("start")){ add = false; }else if (parent[last[0]][last[1]].equals("UL")){ last = new int[]{last[0] + 2, last[1] + 1}; s.push("UL"); }else if (parent[last[0]][last[1]].equals("UR")){ last = new int[]{last[0] + 2, last[1] - 1}; s.push("UR"); }else if (parent[last[0]][last[1]].equals("R")){ last = new int[]{last[0], last[1] - 2}; s.push("R"); }else if (parent[last[0]][last[1]].equals("LL")){ last = new int[]{last[0] - 2, last[1] + 1}; s.push("LL"); }else if (parent[last[0]][last[1]].equals("LR")){ last = new int[]{last[0] - 2, last[1] - 1}; s.push("LR"); }else if (parent[last[0]][last[1]].equals("L")){ last = new int[]{last[0], last[1] + 2}; s.push("L"); } } System.out.println(s.size()); while(!s.isEmpty()){ System.out.print(s.pop() + " "); } System.out.println(""); } 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(); } }