import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { private static int i_diff =0; private static int j_diff = 0; private static boolean i_boolean; private static boolean j_boolean; private static List answer = new ArrayList<>(); static void printShortestPath(int n, int i_start, int j_start, int i_end, int j_end) { boolean i_bool = i_start >= i_end; boolean j_bool = j_start>= j_end; //System.out.println("i_start = " + i_start + " i_end = " + i_end + " j_start = " + j_start + " j_end = " + j_end); if (i_start <0|| j_start<0||i_start > n || j_start > n || i_diff % 2 != 0 || (i_bool != i_boolean && j_boolean!=j_bool)) { System.out.print("Impossible"); return; } //print answer if(i_diff == 0 && j_diff == 0) { System.out.println(answer.size()); answer.stream().sorted((m1, m2) -> m1.getValue() - m2.getValue()) .forEach(s -> System.out.print(s.name() + " ")); return; } if (i_diff == 0) { if (j_diff > 0) { j_diff -= 2; answer.add(move.L); printShortestPath(n, i_start, j_start - 2, i_end, j_end); } else { j_diff += 2; answer.add(move.R); printShortestPath(n, i_start, j_start + 2, i_end, j_end); } } if (i_diff > 0) { i_diff -= 2; if (j_diff >= 0) { j_diff -= 1; answer.add(move.UL); printShortestPath(n, i_start -2, j_start-1, i_end, j_end); } else { j_diff += 1; answer.add(move.UR); printShortestPath(n, i_start-2, j_start+1, i_end, j_end); } } else if (i_diff <0) { i_diff += 2; if (j_diff <= 0) { j_diff += 1; answer.add(move.LR); printShortestPath(n, i_start+2, j_start+1, i_end, j_end); } else { j_diff -= 1; answer.add(move.LL); printShortestPath(n, i_start+2, j_start-1, i_end, j_end); } } } public enum move { UL(1), UR(2), R(3), LR(4), LL(5), L(6); private int priority; public int getValue() { return this.priority; } move(int i) { priority = i; } } 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(); i_diff = i_start - i_end; j_diff = j_start - j_end; i_boolean = i_start >= i_end; j_boolean = j_start>= j_end; printShortestPath(n, i_start, j_start, i_end, j_end); in.close(); } }