import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static int cnt = 0; static String res = ""; static int f = 0; static boolean printShortestPath(int n, int i_start, int j_start, int i_end, int j_end) { if (Math.abs(i_start - i_end) % 2 != 0){ res = "Impossible"; f = 1; return true; } if (i_start >= 0 && i_start < n && j_start >=0 && j_start < n ){ if (i_start == i_end && j_start == j_end){ cnt++; return true; } else { if ((Math.abs(i_start-2 - i_end) <= Math.abs(i_start - i_end)) && (Math.abs(j_start-1 - j_end) <= Math.abs(j_start - j_end))){ res = res + "UL" + " "; if (printShortestPath(n,i_start-2,j_start-1,i_end,j_end) == false){ cnt++; // return false; } return false; } if ((Math.abs(i_start-2 - i_end) <= Math.abs(i_start - i_end)) && (Math.abs(j_start+1 - j_end) <= Math.abs(j_start - j_end))){ res = res + "UR" + " "; if (printShortestPath(n,i_start-2,j_start+1,i_end,j_end) == false){ cnt++; //return false; } return false; } if ((Math.abs(i_start - i_end) <= Math.abs(i_start - i_end)) && (Math.abs(j_start+2 - j_end) <= Math.abs(j_start - j_end))){ res = res + "R" + " "; if (printShortestPath(n,i_start,j_start+2,i_end,j_end) == false){ cnt++; //return false; } return false; } if ((Math.abs(i_start+2 - i_end) <= Math.abs(i_start - i_end)) && (Math.abs(j_start+1 - j_end) <= Math.abs(j_start - j_end))){ res = res + "LR" + " "; if (printShortestPath(n,i_start+2,j_start+1,i_end,j_end) == false){ cnt++; //return false; } return false; } if ((Math.abs(i_start+2 - i_end) <= Math.abs(i_start - i_end)) && (Math.abs(j_start-1 - j_end) <= Math.abs(j_start - j_end))){ res = res + "LL" + " "; if (printShortestPath(n,i_start+2,j_start-1,i_end,j_end) == false){ cnt++; //return false; } return false; } if ((Math.abs(i_start - i_end) <= Math.abs(i_start - i_end)) && (Math.abs(j_start - 2 - j_end) <= Math.abs(j_start - j_end))){ res = res + "L" + " "; if (printShortestPath(n,i_start,j_start-2,i_end,j_end) == false){ cnt++; //return false; } return false; } if (cnt > 10000){ res = "Impossible"; return true; } } } else{ if (i_start < 0) i_start = 0; if (i_start > n-1) i_start = n-1; if (j_start < 0) j_start = 0; if (j_start > n-1) j_start = n-1; cnt--; String[] res1 = res.split(" "); String res2 = ""; for(int i=0; i < res1.length-1; i++){ res2 = res2 + res1[i] + " "; } res = res2; printShortestPath(n,i_start,j_start,i_end,j_end); } return false; // Print the distance along with the sequence of moves. } 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); if (f == 0 ){ System.out.println(cnt); System.out.println(res.trim()); } else{ System.out.println(res); } in.close(); } }