import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public class Cell { public int x; public int y; public Cell(int i, int j) { x = i; y = j; } public boolean equals(Cell b) { return this.x == b.x && this.y == b.y; } public boolean isValid(int n) { if(this.x >= 0 && this.y >= 0 && this.x < n && this.y < n) { return true; } return false; } public String getKey() { return this.x + "," + this.y; } } public class Move { public Cell destination; public Move prev; public String name; public Move(Cell dest, String n) { destination = dest; name = n; } } static void printShortestPath(int n, int start_y, int start_x, int end_y, int end_x) { // Print the distance along with the sequence of moves. Stack stack = new Stack<>(); ArrayList moves; ArrayList solutions = new ArrayList<>(); HashMap seen = new HashMap<>(); Cell s = newCell(start_x, start_y); Cell e = newCell(end_x, end_y); Move m = newMove(s, "S"); seen.put(m.destination.getKey(), true); stack.push(m); while(!stack.empty()) { m = stack.pop(); //System.out.println("explore " + m.destination.x + " / " + m.destination.y); moves = getPossibleMoves(m, n); for(Move move: moves) { //System.out.println(" posmov " + move.destination.x + " / " + move.destination.y); if(move.destination.equals(e)) { m = move; solutions.add(move); break; } if(!seen.containsKey(move.destination.getKey())) { stack.push(move); seen.put(move.destination.getKey(), true); } } if(stack.size() > 1000) { break; } } if(solutions.size() > 0) { Move shortest = newMove(newCell(0, 1), ""); int min = 999999; int steps; for(Move solution: solutions) { steps = countSteps(solution); if(steps < min) { shortest = solution; min = steps; } //System.out.println("Solution"); //System.out.println(" with " + steps + " steps"); //printPath(solution); } //System.out.println("Shortest"); Stack path = new Stack<>(); path = reconstructPath(path, shortest); String out = ""; while(!path.empty()) { out += path.pop() + " "; } System.out.println(min); System.out.println(out.trim()); } else { System.out.println("Impossible"); } } static Stack reconstructPath(Stack path, Move m) { path.push(m.name.toUpperCase()); if(m.prev.name != "S") { path = reconstructPath(path, m.prev); } return path; } static void printPath(Move m) { System.out.println(m.destination.x + "/" + m.destination.y + " " + m.name); if(m.prev.name != "S") { printPath(m.prev); } else { Cell p = m.prev.destination; System.out.println(p.x + "/" + p.y + " " + m.prev.name); } } static int countSteps(Move m) { int n = 1; if(m.prev.name != "S") { n += countSteps(m.prev); } return n; } static ArrayList getPossibleMoves(Move cur, int n) { Solution o = new Solution(); Map offsets = new LinkedHashMap(); offsets.put("l", new int[] {-2, 0}); offsets.put("ll", new int[] {-1, 2}); offsets.put("lr", new int[] { 1, 2}); offsets.put("r", new int[] { 2, 0}); offsets.put("ur", new int[] { 1, -2}); offsets.put("ul", new int[] {-1, -2}); ArrayList moves = new ArrayList(); String key; Cell t; Move m; for(Map.Entry entry : offsets.entrySet()) { String name = entry.getKey(); int[] off = entry.getValue(); t = newCell(cur.destination.x + off[0], cur.destination.y + off[1]); if(t.isValid(n)) { m = o.new Move(t, name); m.prev = cur; moves.add(m); } } return moves; } static Cell newCell(int x, int y) { Solution o = new Solution(); return o.new Cell(x, y); } static Move newMove(Cell destination, String name) { Solution o = new Solution(); return o.new Move(destination, name); } 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(); } }