import java.util.*; public class Solution { static Integer[][] previousI; static Integer[][] previousJ; static String[][] previousMove; static List nextI = new LinkedList<>(); static List nextJ = new LinkedList<>(); static void addMove(int n, int prevI, int prevJ, int i, int j, String move) { if ((i >= 0) && (i < n) && (j >= 0) && (j < n) && (previousI[i][j] == null)) { previousI[i][j] = prevI; previousJ[i][j] = prevJ; previousMove[i][j] = move; nextI.add(i); nextJ.add(j); } } static void printSolution(int moves, int i, int j, int i_start, int j_start) { if ((i == i_start) && (j == j_start)) { System.out.println(moves); } else { printSolution(moves + 1, previousI[i][j], previousJ[i][j], i_start, j_start); System.out.print(previousMove[i][j]); if (moves > 0) { System.out.print(' '); } } } static void printShortestPath(int n, int i_start, int j_start, int i_end, int j_end) { previousI = new Integer[n][n]; previousJ = new Integer[n][n]; previousMove = new String[n][n]; previousI[i_start][j_start] = -1; previousJ[i_start][j_start] = -1; nextI.add(i_start); nextJ.add(j_start); while (!nextI.isEmpty()) { int i = nextI.remove(0); int j = nextJ.remove(0); if ((i == i_end) && (j == j_end)) { break; } addMove(n, i, j, i - 2, j - 1, "UL"); addMove(n, i, j, i - 2, j + 1, "UR"); addMove(n, i, j, i, j + 2, "R"); addMove(n, i, j, i + 2, j + 1, "LR"); addMove(n, i, j, i + 2, j - 1, "LL"); addMove(n, i, j, i, j - 2, "L"); } if (previousI[i_end][j_end] == null) { System.out.println("Impossible"); } else { printSolution(0, i_end, j_end, i_start, j_start); } } 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(); } }