import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; class mat{ int x, y; String parent=""; mat t=null; mat(int x,int y,String parent,mat t){ this.x=x; this.y=y; this.parent=parent; this.t=t; } } public class Solution { static boolean visited[][]; static void printShortestPath(int n, int i, int j, int dest_x, int dest_y) { mat source=new mat(i,j,"",null); Queue qu=new LinkedList<>(); visited=new boolean[n+1][n+1]; qu.add(source); visited[source.x][source.y]=true; bfs(qu,dest_x,dest_y,n); } static void bfs(Queuequ,int dest_x,int dest_y,int n){ while(!qu.isEmpty()){ mat temp=qu.poll(); if(temp.x==dest_x && temp.y==dest_y){ ArrayListal=new ArrayList<>(); while(temp.t!=null){ al.add(temp.parent); temp=temp.t; } System.out.println(al.size()); Collections.reverse(al); for(String st:al){ System.out.print(st+" "); } System.out.println(); return; } if(temp.x>=2 && temp.y>=1 && visited[temp.x-2][temp.y-1]==false){ qu.add(new mat(temp.x-2,temp.y-1,"UL",temp)); visited[temp.x-2][temp.y-1]=true; } if(temp.x>=2 && temp.y<=n-2 && visited[temp.x-2][temp.y+1]==false){ qu.add(new mat(temp.x-2,temp.y+1,"UR",temp)); visited[temp.x-2][temp.y+1]=true; } if(temp.y<=n-3 && visited[temp.x][temp.y+2]==false){ qu.add(new mat(temp.x,temp.y+2,"R",temp)); visited[temp.x][temp.y+2]=true; } if(temp.x<=n-3 && temp.y<=n-2 && visited[temp.x+2][temp.y+1]==false){ qu.add(new mat(temp.x+2,temp.y+1,"LR",temp)); visited[temp.x+2][temp.y+1]=true; } if(temp.x<=n-3 && temp.y>0 && visited[temp.x+2][temp.y-1]==false){ qu.add(new mat(temp.x+2,temp.y-1,"LL",temp)); visited[temp.x+2][temp.y-1]=true; } if(temp.y>=2 && visited[temp.x][temp.y-2]==false){ qu.add(new mat(temp.x,temp.y-2,"L",temp)); visited[temp.x][temp.y-2]=true; } } System.out.println("Impossible");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(); } }