using System; using System.Collections.Generic; using System.IO; using System.Linq; class Solution { static void printShortestPath(int n, int i_start, int j_start, int i_end, int j_end) { // Print the distance along with the sequence of moves. bool impossible = false; int i_pos = i_start; int j_pos = j_start; int totalMoves = 0; String output = ""; double temp1 = Math.Abs(i_end - i_start); double temp2 = Math.Abs(j_end - j_start); if (Math.Abs(i_end - i_start) % 2 != 0.0) { impossible = true; } else if (Math.Abs(Math.Abs(j_pos - (Math.Abs(i_end - i_start) / 2)) - j_end) % 2 != 0.0) { impossible = true; } while (!impossible) { if (i_pos == i_end) { if (Math.Abs((i_end - i_start) % 2) == 0 && i_pos == i_end) { if (j_pos > j_end) { j_pos -= 2; output += "L "; } else { j_pos += 2; output += "R "; } } else { impossible = true; } } else if (i_pos > i_end) { i_pos -= 2; if (j_pos >= j_end) { if (j_pos - 1 >= 0) { j_pos -= 1; output += "UL "; } else { j_pos += 1; output += "UR "; } } else { if (j_pos + 1 <= n - 1) { j_pos += 1; output += "UR "; } else { j_pos -= 1; output += "UL "; } } } else if (i_pos < i_end) { i_pos += 2; if (j_pos <= j_end) { if (j_pos + 1 <= n - 1) { j_pos += 1; output += "LR "; } else { j_pos -= 1; output += "LL "; } } else { if (j_pos - 1 >= 0) { j_pos -= 1; output += "LL "; } else { j_pos += 1; output += "LR "; } } } totalMoves += 1; if (i_pos == i_end && j_pos == j_end) { break; } } if (impossible) { Console.WriteLine("Impossible"); } else { Console.WriteLine(totalMoves); Console.WriteLine(output); } } 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); } }