import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static int diff[][] = {{-2,-1},{-2,1},{0, 2},{2,1},{2,-1},{0,-2}}; static String dir[] = {"UL", "UR", "R", "LR", "LL", "L"}; 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 vis[][] = new boolean[n][n]; //BFS Queue queue = new LinkedList<>(); int depth = 0; Pair root = new Pair(i_start, j_start); Pair dest = new Pair(i_end, j_end); PairPath rootPairPath = new PairPath(new ArrayList<>(), root); queue.add(rootPairPath); queue.add(null); vis[root.x][root.y] = true; int minSize = Integer.MAX_VALUE; List minPath = Collections.emptyList(); while(!queue.isEmpty()) { PairPath currPairPath = queue.poll(); if(currPairPath == null) { depth++; if(!queue.isEmpty()) queue.add(null); continue; } List pathtillNow = currPairPath.path; Pair pair = currPairPath.pair; if(pair.equals(dest)) { minSize = pathtillNow.size(); minPath = pathtillNow; break; } else { int len = diff.length; for(int i=0; i < len; i++) { int p[] = diff[i]; int x_ = pair.x + p[0]; int y_ = pair.y + p[1]; if(x_ >= 0 && x_ < n && y_ >= 0 && y_ < n && !vis[x_][y_]) { Pair recPair= new Pair(x_, y_); List newpath = new ArrayList<>(pathtillNow); newpath.add(dir[i]); PairPath newPairPath = new PairPath(newpath, recPair); queue.add(newPairPath); vis[x_][y_] = true; } } } } if(minSize != Integer.MAX_VALUE) { String print = String.join(" ", minPath); System.out.println(minSize); System.out.println(print); } else { 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(); } } class Pair { int x; int y; public Pair(int x, int y) { this.x = x; this.y = y; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Pair pair = (Pair) o; if (x != pair.x) return false; return y == pair.y; } @Override public int hashCode() { int result = x; result = 31 * result + y; return result; } } class PairPath { List path; Pair pair; public PairPath(List path, Pair pair) { this.path = path; this.pair = pair; } }