using System; using System.Collections.Generic; using System.IO; using System.Linq; class Solution { static void printShortestPath(int n, int j_start, int i_start, int j_end, int i_end) { if ((j_start - j_end) % 2 != 0) { Console.WriteLine("Impossible"); return; } else if((Math.Abs(j_start - j_end) % 4 == 2) && (Math.Abs(i_start - i_end) % 2 == 0)) { Console.WriteLine("Impossible"); return; } else if((Math.Abs(j_start - j_end) % 4 == 0) && (Math.Abs(i_start - i_end) % 2 == 1)) { Console.WriteLine("Impossible"); return; } else { int iNow = i_start; int jNow = j_start; int[] move = new int[n]; int k = 0; while ((iNow != i_end) || (jNow != j_end)) { if (j_end > jNow) { if (i_end > iNow) { move[k] = 4; iNow += 1; jNow += 2; } else if (i_end < iNow) { move[k] = 5; iNow -= 1; jNow += 2; } else { if (iNow == n - 1) { move[k] = 5; iNow -= 1; jNow += 2; } else if (iNow == 0) { move[k] = 4; iNow += 1; jNow += 2; } else { move[k] = 4; iNow += 1; jNow += 2; } } } else if (j_end < jNow) { if (i_end > iNow) { move[k] = 2; iNow += 1; jNow -= 2; } else if (i_end < iNow) { move[k] = 1; iNow -= 1; jNow -= 2; } else { if (iNow == n - 1) { move[k] = 1; iNow -= 1; jNow -= 2; } else if (iNow == 0) { move[k] = 2; iNow += 1; jNow -= 2; } else { move[k] = 2; iNow += 1; jNow -= 2; } } } else { if (i_end > iNow) { move[k] = 3; iNow += 2; } else { move[k] = 6; iNow -= 2; } } k++; } Console.WriteLine(k); k = 0; while (move[k] != 0){ switch (move[k]){ case 1: Console.Write("UL"); break; case 2: Console.Write("UR"); break; case 3: Console.Write("R"); break; case 4: Console.Write("LR"); break; case 5: Console.Write("LL"); break; case 6: Console.Write("L"); break; } if (move[k + 1] != 0){ Console.Write(" "); } k++; } } } static void Main(String[] args) { int n = Convert.ToInt32(Console.ReadLine()); string[] tokens_i_start = Console.ReadLine().Split(' '); int i_start = Convert.ToInt32(tokens_i_start[0]); int j_start = Convert.ToInt32(tokens_i_start[1]); int i_end = Convert.ToInt32(tokens_i_start[2]); int j_end = Convert.ToInt32(tokens_i_start[3]); printShortestPath(n, i_start, j_start, i_end, j_end); } }