import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static class P{ int x,y; P(int X,int Y){ x = X; y = Y; } } static HashMap C = new HashMap(0); static String printShortestPath(int n, int istart, int jstart, int iend, int jend) { String M[][] = new String[n][n]; LinkedList

qt; LinkedList

qq = new LinkedList

(); LinkedList

q = new LinkedList

(); q.add(new P(jstart,istart)); M[jstart][istart] = ""; int Nm1 = n-1; int Nm2 = n-2; StringBuilder path = new StringBuilder(2000); P t; while( !q.isEmpty() ){ while( !q.isEmpty() ){ t = q.pollFirst(); if( t.x == jend && t.y == iend ){ return M[t.x][t.y]; } path.append(M[t.x][t.y]); if( t.x > 0 && t.y > 1 && M[t.x-1][t.y-2] == null ){ path.append('0'); M[t.x-1][t.y-2] = path.toString(); qq.add( new P(t.x-1,t.y-2) ); path.setLength(path.length()-1); } if( t.x < Nm1 && t.y > 1 && M[t.x+1][t.y-2] == null ){ path.append('1'); M[t.x+1][t.y-2] = path.toString(); qq.add( new P(t.x+1,t.y-2) ); path.setLength(path.length()-1); } if( t.x < Nm2 && M[t.x+2][t.y] == null ){ path.append('2'); M[t.x+2][t.y] = path.toString(); qq.add( new P(t.x+2,t.y) ); path.setLength(path.length()-1); } if( t.x < Nm1 && t.y < Nm2 && M[t.x+1][t.y+2] == null ){ path.append('3'); M[t.x+1][t.y+2] = path.toString(); qq.add( new P(t.x+1,t.y+2) ); path.setLength(path.length()-1); } if( t.x > 0 && t.y < Nm2 && M[t.x-1][t.y+2] == null ){ path.append('4'); M[t.x-1][t.y+2] = path.toString(); qq.add( new P(t.x-1,t.y+2) ); path.setLength(path.length()-1); } if( t.x > 1 && M[t.x-2][t.y] == null ){ path.append('5'); M[t.x-2][t.y] = path.toString(); qq.add( new P(t.x-2,t.y) ); } path.setLength(0); } qt = qq; qq = q; q = qt; qq.clear(); } return "6"; } 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(); String path = printShortestPath(n, i_start, j_start, i_end, j_end); char P[] = path.toCharArray(); if( P[0] != '6' ) System.out.println(P.length); StringBuilder sb = new StringBuilder(1000); for( int i = 0; i < P.length; i++ ){ int x = P[i]-'0'; sb.append( x == 0 ? "UL " : (x == 1 ? "UR " : (x == 2 ? "R " : (x == 3 ? "LR " : (x == 4 ? "LL " : (x == 5 ? "L " : "Impossible " ) ) ) ) ) ); } sb.setLength(sb.length()-1); System.out.println(sb); in.close(); } }