import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static final int UL = 0; public static final int UR = 1; public static final int R = 2; public static final int LR = 3; public static final int LL = 4; public static final int L = 5; public static final int MAX_MOVE = 6; public static final String[] MOVES = {"UL", "UR", "R", "LR", "LL", "L"}; public static class MyScanner { BufferedReader in; StringTokenizer st; public MyScanner() { in = new BufferedReader(new InputStreamReader(System.in)); } String next() { if (st == null || !st.hasMoreTokens()) { try { st = new StringTokenizer(in.readLine()); } catch (IOException e) { } } return st.nextToken(); } int nextInt() { return Integer.parseInt(this.next()); } } public static class Node { public boolean seen; public int distance; public List edges; public Map moves; public Node prev; public int move; public Node() { this.seen = false; this.distance = Integer.MAX_VALUE; this.edges = new ArrayList(); this.moves = new HashMap(); this.prev = null; this.move = MAX_MOVE; } } public static class Query implements Comparable { public Node node; public int distance; public Query(Node node, int distance) { this.node = node; this.distance = distance; } public int compareTo(Query o) { return this.distance - o.distance; } } 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. Node[][] nodes = new Node[n][n]; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { Node node = new Node(); nodes[i][j] = node; } } for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { Node node = nodes[i][j]; if (i > 1 && j > 0) { node.edges.add(nodes[i - 2][j - 1]); node.moves.put(nodes[i - 2][j - 1], UL); } if (i > 1 && j < n - 1) { node.edges.add(nodes[i - 2][j + 1]); node.moves.put(nodes[i - 2][j + 1], UR); } if (j < n - 2) { node.edges.add(nodes[i][j + 2]); node.moves.put(nodes[i][j + 2], R); } if (i < n - 2 && j < n - 1) { node.edges.add(nodes[i + 2][j + 1]); node.moves.put(nodes[i + 2][j + 1], LR); } if (i < n - 2 && j > 0) { node.edges.add(nodes[i + 2][j - 1]); node.moves.put(nodes[i + 2][j - 1], LL); } if (j > 2) { node.edges.add(nodes[i][j - 2]); node.moves.put(nodes[i][j - 2], L); } } } Node start = nodes[i_start][j_start]; Node end = nodes[i_end][j_end]; start.distance = 0; Queue q = new LinkedList(); q.add(new Query(start, 0)); while (!q.isEmpty()) { Query query = q.poll(); Node A = query.node; int d = A.distance + 1; for (int i = 0; i < A.edges.size(); i++) { Node B = A.edges.get(i); if (d < B.distance) { B.distance = d; B.move = A.moves.get(B); q.add(new Query(B, d)); B.prev = A; } } } if (end.prev == null) { System.out.println("Impossible"); } else { System.out.println(end.distance); printMoves(start, end); } } public static void printMoves(Node start, Node end) { List moves = new ArrayList(); Node node = end; while (node.prev != null) { moves.add(0, node.move); node = node.prev; } System.out.print(MOVES[moves.get(0)]); for (int i = 1; i < moves.size(); i++) { System.out.print(" " + MOVES[moves.get(i)]); } } 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(); } }