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. boolean[][] visited = new boolean[n][n]; LinkedList next = new LinkedList<>(); next.add(new Node(i_start, j_start, "", null)); while (!next.isEmpty()) { Node nd = next.poll(); if ((nd.i == i_end) && (nd.j == j_end)) { int count = 0; Stack moves = new Stack<>(); while (nd.parent != null) { moves.push(nd.dirTo); count++; nd = nd.parent; } System.out.println(count); while (!moves.empty()) { System.out.print(moves.pop() + " "); } System.out.print("\n"); return; } visit(nd, next, visited); } System.out.println("Impossible"); } static void visit(Node nd, Queue next, boolean[][] visited) { // UL UR if (nd.i - 2 >= 0) { // UL if ((nd.j - 1 >= 0) && (!visited[nd.i - 2][nd.j - 1])) { next.add(new Node(nd.i - 2, nd.j - 1, "UL", nd)); visited[nd.i - 2][nd.j - 1] = true; } // UR if ((nd.j + 1 <= visited[0].length - 1) && (!visited[nd.i - 2][nd.j + 1])) { next.add(new Node(nd.i - 2, nd.j + 1, "UR", nd)); visited[nd.i - 2][nd.j + 1] = true; } } // R if ((nd.j + 2 <= visited[0].length - 1) && (!visited[nd.i][nd.j+2])) { next.add(new Node(nd.i, nd.j + 2, "R", nd)); visited[nd.i][nd.j+2] = true; } // LR LL if (nd.i + 2 <= visited.length - 1) { // LR if ((nd.j + 1 <= visited[0].length - 1) && (!visited[nd.i + 2][nd.j + 1])) { next.add(new Node(nd.i + 2, nd.j + 1, "LR", nd)); visited[nd.i + 2][nd.j + 1] = true; } // LL if ((nd.j - 1 >= 0) && (!visited[nd.i + 2][nd.j - 1])) { next.add(new Node(nd.i + 2, nd.j - 1, "LL", nd)); visited[nd.i + 2][nd.j - 1] = true; } } // L if ((nd.j - 2 >= 0) && (!visited[nd.i][nd.j - 2])) { next.add(new Node(nd.i, nd.j - 2, "L", nd)); visited[nd.i][nd.j - 2] = true; } } 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(); } static class Node { int i; int j; String dirTo; Node parent; private Node(int i, int j, String dirTo, Node parent) { this.i = i; this.j = j; this.dirTo = dirTo; this.parent = parent; } } }