import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { class Node { int x; int y; Node parent; String path; int count; public Node(int x, int y, Node parent, String path, int count) { this.x = x; this.y = y; this.parent = parent; this.path = path; this.count = count; } } 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. // UL, UR, R, LR, LL, L Solution s = new Solution(); s.bfs(n, i_start, j_start, i_end, j_end); } private void bfs(int n, int x, int y, int x1, int y1) { Queue q = new LinkedList(); Set> v = new HashSet(); q.add(new Node(x, y, null, "", 0)); v.add(Arrays.asList(x, y)); int count = 0; while(!q.isEmpty()) { Node k = q.poll(); if(k.x == x1 && k.y == y1) { System.out.println(k.count); StringBuilder ans = new StringBuilder(); Node res = k; while(res != null) { ans.insert(0, " " + res.path); res = res.parent; } System.out.println(ans.toString().trim()); return; } // UL int a = k.x -2; int b = k.y - 1; count = k.count + 1; if(a >= 0 && b >= 0 && v.add(Arrays.asList(a, b))) { q.add(new Node(a, b, k, "UL", count)); } // UR a = k.x -2; b = k.y + 1; if(a >= 0 && b < n && v.add(Arrays.asList(a, b))) { q.add(new Node(a, b, k, "UR", count)); } // R a = k.x; b = k.y + 2; if(b < n && v.add(Arrays.asList(a, b))) { q.add(new Node(a, b, k, "R", count)); } // LR a = k.x + 2; b = k.y + 1; if(a < n && b < n && v.add(Arrays.asList(a, b))) { q.add(new Node(a, b, k, "LR", count)); } // LL a = k.x + 2; b = k.y - 1; if(a < n && b >= 0 && v.add(Arrays.asList(a, b))) { q.add(new Node(a, b, k, "LL", count)); } // L a = k.x; b = k.y - 2; if(b >= 0 && v.add(Arrays.asList(a, b))) { q.add(new Node(a, b, k, "L", count)); } count++; } 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(); } }