import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; import java.awt.Point; public class Solution { static void printShortestPath(int n, int i_start, int j_start, int i_end, int j_end) { Queue> paths = new ArrayDeque<>(); Queue queue = new ArrayDeque<>(); Set visited = new HashSet<>(); paths.add(new ArrayList()); queue.add(new Point(j_start, i_start)); while(!queue.isEmpty()){ Point current = queue.poll(); List pathSoFar = paths.poll(); //System.out.println(String.valueOf(current.x) + ", " + String.valueOf(current.y)); //printPath(pathSoFar); //System.out.println(" "); if(current.x == j_end && current.y == i_end){ System.out.println(pathSoFar.size()); printPath(pathSoFar); return; } visited.add(current); Point UL = new Point(current.x - 1, current.y - 2); if(!visited.contains(UL) && isInBound(UL, n)){ queue.add(UL); List temp = new ArrayList<>(pathSoFar); temp.add("UL"); paths.add(temp); } Point UR = new Point(current.x + 1, current.y - 2); if(!visited.contains(UR) && isInBound(UR, n)){ queue.add(UR); List temp = new ArrayList<>(pathSoFar); temp.add("UR"); paths.add(temp); } Point R = new Point(current.x + 2, current.y); if(!visited.contains(R) && isInBound(R, n)){ queue.add(R); List temp = new ArrayList<>(pathSoFar); temp.add("R"); paths.add(temp); } Point LR = new Point(current.x + 1, current.y + 2); if(!visited.contains(LR) && isInBound(LR, n)){ queue.add(LR); List temp = new ArrayList<>(pathSoFar); temp.add("LR"); paths.add(temp); } Point LL = new Point(current.x - 1, current.y + 2); if(!visited.contains(LL) && isInBound(LL, n)){ queue.add(LL); List temp = new ArrayList<>(pathSoFar); temp.add("LL"); paths.add(temp); } Point L = new Point(current.x - 2, current.y); if(!visited.contains(L) && isInBound(L, n)){ queue.add(L); List temp = new ArrayList<>(pathSoFar); temp.add("L"); paths.add(temp); } } System.out.println("Impossible"); } public static void printPath(List list){ for(String s : list){ System.out.print(s + " "); } } public static boolean isInBound(Point p, int n){ if(p.x >= 0 && p.x <= n && p.y >=0 && p.y <=n) return true; return false; } 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(); } }