import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; class cell{ int si , sj , mov; String s = ""; cell par; cell(int x , int y , int m , String s , cell par) { si = x; sj = y; mov = m; this.s = s; this.par = par; } } public class Solution { static boolean isInside(int x, int y, int n) { if (x >= 0 && x <= n-1 && y >= 0 && y <= n-1) return true; return false; } static void printShortestPath(int n, int si, int sj, int ei, int ej) { boolean visited[][] = new boolean[n][n]; visited[si][sj] = true; Queue q = new LinkedList<>(); q.add(new cell(si , sj , 0 , "" , null)); cell t; ArrayList list = new ArrayList<>(); //String str = ""; while(!q.isEmpty()) { t = q.poll(); visited[t.si][t.sj] = true; if(t.si==ei && t.sj==ej) { System.out.println(t.mov); list.add(t.s); while(t.par!=null) { list.add(t.par.s); t = t.par ; } for(int i = list.size()-2 ; i>=0; i--) System.out.print(list.get(i)+" "); return; } else { if(isInside(t.si-2 , t.sj-1 , n) && !visited[t.si-2][t.sj-1]) // UL q.add(new cell(t.si-2 , t.sj-1 , t.mov+1 , "UL" , t)); if(isInside(t.si-2 , t.sj+1 , n) && !visited[t.si-2][t.sj+1])// UR q.add(new cell(t.si-2 , t.sj+1 , t.mov+1 , "UR", t)); if(isInside(t.si , t.sj+2 , n) && !visited[t.si][t.sj+2])// R q.add(new cell(t.si , t.sj+2 , t.mov+1 , "R" , t)); if(isInside(t.si+2 , t.sj+1 , n) && !visited[t.si+2][t.sj+1]) // LR q.add(new cell(t.si+2 , t.sj+1 , t.mov+1 , "LR", t)); if(isInside(t.si+2 , t.sj-1 , n) && !visited[t.si+2][t.sj-1])// LL q.add(new cell(t.si+2 , t.sj-1 , t.mov+1 , "LL", t)); if(isInside(t.si , t.sj-2 , n) && !visited[t.si][t.sj-2])// L q.add(new cell(t.si , t.sj-2 , t.mov+1 , "L" , t)); } } System.out.println("Impossible"); } 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(); } }