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) { String[] moves = new String[n]; List result = move(n, i_start, j_start, i_end, j_end, 0, moves); if(!result.isEmpty()){ System.out.println(result.size()); for(String val: result){ System.out.print(val + " "); } }else{ System.out.println("Impossible"); } } private static List move(int n, int i_start, int j_start, int i_end, int j_end, int depth, String[] moves) { if(i_start == i_end && j_start == j_end){ List result = new ArrayList<>(); for(int i = 0; i < depth; i++){ result.add(moves[i]); } return result; } if(depth == n){ return new ArrayList<>(); } List minResult = new ArrayList<>(); if(i_start - 2 > -1 && j_start - 1 > -1){ moves[depth] = "UL"; minResult= move(n, i_start - 2, j_start - 1, i_end, j_end, depth + 1, moves); } if(i_start - 2 > -1 && j_start + 1 < n){ moves[depth] = "UR"; List result = move(n, i_start - 2, j_start + 1, i_end, j_end, depth + 1, moves); if(!result.isEmpty() && (result.size() < minResult.size() || minResult.isEmpty())){ minResult = result; } } if(j_start + 2 < n){ moves[depth] = "R"; List result = move(n, i_start, j_start + 2, i_end, j_end, depth + 1, moves); if(!result.isEmpty() && (result.size() < minResult.size() || minResult.isEmpty())){ minResult = result; } } if(i_start + 2 < n && j_start + 1 < n){ if(depth == 0){ int y = 1; int u = y; } moves[depth] = "LR"; List result = move(n, i_start + 2, j_start + 1, i_end, j_end, depth + 1, moves); if(!result.isEmpty() && (result.size() < minResult.size() || minResult.isEmpty())){ minResult = result; } } if(i_start + 2 < n && j_start - 1 > -1){ if(depth == 1){ int y = 1; int u = y; } moves[depth] = "LL"; List result = move(n, i_start + 2, j_start - 1, i_end, j_end, depth + 1, moves); if(!result.isEmpty() && (result.size() < minResult.size() || minResult.isEmpty())){ minResult = result; } } if(j_start - 2 > -1){ moves[depth] = "L"; List result = move(n, i_start, j_start - 2, i_end, j_end, depth + 1, moves); if(!result.isEmpty() && (result.size() < minResult.size() || minResult.isEmpty())){ minResult = result; } } return minResult; } 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(); } }