import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Move { String name; public getName(){ return this.name; } int x; public getX(){ return this.x; } int y; public getY(){ return this.y; } int order; public getOrder(){ return this.order; } public void Move(String name, int x, int y, int order) { this.name = name; this.x = x; this.y = y; this.order = order; } } public class Node { int x; public getX() { return this.x; } int y; public getY() { return this.y; } public void Node(x, y) { this.x = x; this.y = y; } Move move; public getMove() { return this.move; } public setMove(Move move) { this.move = move; } } public class Solution { List path = new ArrayList (); 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. Move[] moves = {new Move("R", 2, 0, 0), new Move("LR", 1, 2, 1), new Move("LL", -1, 2, 2), new Move("L", -2, 0, 3), new Move("UL", -1, -2, 4), new Move("UR", 1, -2, 5)}; Node lastNode = new Node(i_start, j_start); Solution.path.add(lastNode); int lastCell = n - 1; int shortestPath = Integer.MAX_VALUE; for (int position = 0; position < moves.length && Solution.path.size() < shortestPath; position++) { if ((moves[position].getX() + lastNode.getX() > lastCell) || (moves[position].getY() + lastNode.getY() > lastCell) || (moves[position].getX() + lastNode.getX() < 0) || (moves[position].getY() + lastNode.getY() < 0)) { if (position == moves.length - 1) { Solution.path.remove(Solution.path.size() - 1); position = -1; } } else { lastNode = new Node(lastNode.getX() + moves[position].getX(), lastNode.getY() + moves[position].getY()); lastNode.setMove(moves[position]); Solution.path.add(lastNode); if (lastNode.getX() == i_end && lastNode.getY() == j_end) { if (Solution.path.size() < shortestPath) { shortestPath = Solution.path.size(); } Solution.path.remove(Solution.path.size() - 1); position = Solution.path.get(Solution.path.size() - 1).getOrder(); } else { position = -1; } } } String result; if (shortestPath == Integer.MAX_VALUE){ result = "Impossible"; System.out.println(result); } else { for(position = 1; position < Solution.path.size(); position++) { result += Solution.path[position].getMove().getName(); if (position < Solution.path.size() - 1) { result += " "; } } System.out.println(shortestPath - 1); System.out.println(result); } } 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(); } }