import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static int i_current, j_current; static int i_prev, j_prev; static int numberOfMoves = 0; static StringBuilder moves = new StringBuilder(); 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. int[][] arr = new int[n][n]; boolean destinationReached = false; boolean impossible = false; i_current = i_start; j_current = j_start; while (!destinationReached && !impossible ) { if(validMove(i_current, -2, n) && validMove(j_current, -1, n) && closerToDest(i_current, j_current, i_current-2, j_current-1, i_end, j_end)) { move(i_current-2, j_current-1, "UL "); } else if(validMove(i_current, -2, n) && validMove(j_current, +1, n) && closerToDest(i_current, j_current, i_current-2, j_current+1, i_end, j_end)) { move(i_current-2, j_current+1, "UR "); } else if(validMove(j_current, +2, n) && closerToDest(i_current, j_current, i_current, j_current+2, i_end, j_end)) { move(i_current, j_current+2, "R "); } else if(validMove(i_current, +2, n) && validMove(j_current, +1, n) && closerToDest(i_current, j_current, i_current+2, j_current+1, i_end, j_end)) { move(i_current+2, j_current+1, "LR "); } else if(validMove(i_current, +2, n) && validMove(j_current, -1, n) && closerToDest(i_current, j_current, i_current+2, j_current-1, i_end, j_end)) { move(i_current+2, j_current-1, "LL "); } else if(validMove(j_current, -2, n) && closerToDest(i_current, j_current, i_current, j_current-2, i_end, j_end)) { move(i_current, j_current-2, "L "); } else { impossible = true; } destinationReached = ((i_current == i_end) && (j_current == j_end)) ? true : false; } if(destinationReached) { System.out.println(numberOfMoves); System.out.println(moves.toString()); } else { System.out.println("Impossible"); } } static boolean validMove(int current, int move, int n) { return (((current + move) >= 0) && ((current + move) <= n-1) && ((current + move) != i_prev) && ((current + move) != j_prev)) ? true : false; } static boolean closerToDest(int i_current, int j_current, int i_next, int j_next, int i_end, int j_end) { return ((Math.abs(i_end-i_next) < Math.abs(i_end-i_current)) || (Math.abs(j_end-j_next) < Math.abs(j_end-j_current))) ? true : false; } static void move(int i_next, int j_next, String move) { i_prev = i_current; j_prev = j_current; i_current = i_next; j_current = j_next; numberOfMoves++; moves.append(move); } 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(); } }