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 i1, int j1, int i2, int j2) { // Print the distance along with the sequence of moves. Queue que=new LinkedList<>(); que.add(new int[]{i1,j1,0,0,-1}); int[][][] prev=new int[n][n][3]; //prev[i1][j1][2]=-1; int ans=0; while(que.size()>0){ Queue temp=new LinkedList<>(); while(que.size()>0){ int[] arr=que.poll(); //System.out.println(arr[0]+" "+arr[1]); if(arr[0]<0||arr[0]>=n||arr[1]<0||arr[1]>=n||prev[arr[0]][arr[1]][2]!=0) continue; if(arr[0]==i2&&arr[1]==j2){ System.out.println(ans); String str=turn(arr[4]); int i=arr[2],j=arr[3]; while(prev[i][j][2]!=-1){ str=turn(prev[i][j][2])+" "+str; int i3=prev[i][j][0],i4=prev[i][j][1]; i=i3; j=i4; } System.out.println(str); return; } prev[arr[0]][arr[1]][0]=arr[2]; prev[arr[0]][arr[1]][1]=arr[3]; prev[arr[0]][arr[1]][2]=arr[4]; int i=arr[0],j=arr[1]; temp.add(new int[]{i-2,j-1,i,j,1}); temp.add(new int[]{i-2,j+1,i,j,2}); temp.add(new int[]{i,j+2,i,j,3}); temp.add(new int[]{i+2,j+1,i,j,4}); temp.add(new int[]{i+2,j-1,i,j,5}); temp.add(new int[]{i,j-2,i,j,6}); } ans++; que=temp; } System.out.println("Impossible"); } public static String turn(int x){ switch(x){ case 1: return "UL"; case 2: return "UR"; case 3: return "R"; case 4: return "LR"; case 5: return "LL"; case 6: return "L"; } return ""; } 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(); } }