import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static int tam; static ArrayList ret; static void printShortestPath(int n, int i_start, int j_start, int i_end, int j_end) { tam = Integer.MAX_VALUE; boolean[][] matrix = new boolean[n][n]; ArrayListreto = new ArrayList(); ret=new ArrayList(); minimo(i_start, j_start, i_end, j_end, matrix, reto); if (ret.size()>0) { System.out.println(ret.size()); for (int i = 0; i < ret.size(); i++) { System.out.print(ret.get(i) + " "); } System.out.println(); } else System.out.println("Impossible"); } static void minimo(int is, int js, int ie, int je, boolean[][] m, ArrayList recorrido) { if (is == ie && js == je && tam > recorrido.size()) { ret = (ArrayList) recorrido.clone(); tam = recorrido.size(); } else { // UL if (is - 2 >= 0 && js - 1 >= 0 && !m[is - 2][js - 1]) { recorrido.add("UL"); m[is - 2][js - 1] = true; minimo(is - 2, js - 1, ie, je, m, recorrido); recorrido.remove(recorrido.size() - 1); m[is - 2][js - 1] = false; } // UR if (is - 2 >= 0 && js + 1 < m.length && !m[is - 2][js + 1]) { recorrido.add("UR"); m[is - 2][js + 1] = true; minimo(is - 2, js + 1, ie, je, m, recorrido); recorrido.remove(recorrido.size() - 1); m[is - 2][js + 1] = false; } // R if (js + 2 < m.length && !m[is][js + 2]) { recorrido.add("R"); m[is][js + 2] = true; minimo(is, js + 2, ie, je, m, recorrido); recorrido.remove(recorrido.size() - 1); m[is][js + 2] = false; } // LR if (is + 2 < m.length && js + 1 < m.length && !m[is + 2][js + 1]) { recorrido.add("LR"); m[is + 2][js + 1] = true; minimo(is + 2, js + 1, ie, je, m, recorrido); recorrido.remove(recorrido.size() - 1); m[is + 2][js + 1] = false; } // LL if (is + 2 < m.length && js - 1 >= 0 && !m[is + 2][js - 1]) { recorrido.add("LL"); m[is + 2][js - 1] = true; minimo(is + 2, js - 1, ie, je, m, recorrido); recorrido.remove(recorrido.size() - 1); m[is + 2][js - 1] = false; } // L if (js - 2 >= 0 && !m[is][js - 2]) { recorrido.add("L"); m[is][js - 2] = true; minimo(is, js - 2, ie, je, m, recorrido); recorrido.remove(recorrido.size() - 1); m[is][js - 2] = false; } } } 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(); } }