import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { 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[][] marked = new int[n][n]; marked[i_start][j_start] = 1; String[] pos = new String[]{"UL","UR","R","LR","LL","L"}; HashMap dx = new HashMap<>(); HashMap dy = new HashMap<>(); dx.put(pos[0],-2);dy.put(pos[0],-1); dx.put(pos[1],-2);dy.put(pos[1],1); dx.put(pos[2],0);dy.put(pos[2],2); dx.put(pos[3],2);dy.put(pos[3],1); dx.put(pos[4],2);dy.put(pos[4],-1); dx.put(pos[5],0);dy.put(pos[5],-2); String ret = minPath(n,i_start,j_start,i_end,j_end,marked,pos,dx,dy,1); if (ret.endsWith("F")) { System.out.println(ret.split(" ").length - 1); System.out.println(ret.substring(0,ret.length() - 2)); }else System.out.println("Impossible"); } public static String minPath(int n,int i_start, int j_start, int i_end, int j_end, int[][] marked,String[] pos,HashMap dx,HashMap dy ,int trail){ String ret = "" ; if (i_start == i_end && j_start == j_end) return "F"; if (i_start < 0 || j_start < 0 || i_start >= n || j_start >= n|| (marked[i_start][j_start]>0 && trail > marked[i_start][j_start])) return "B"; marked[i_start][j_start] = trail ; int m = Integer.MAX_VALUE; for(String po:pos){ String sul = minPath(n,i_start + dx.get(po),j_start + dy.get(po),i_end,j_end,marked,pos,dx,dy,trail+1); int iul = sul.endsWith("F") ? sul.split(" ").length - 1 : Integer.MAX_VALUE ; if (m>iul) { m = iul; ret = po+" "+sul; } } return ret ; } 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(); } }