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. if((Math.Abs(i_end-i_start) %4 != 0 && Math.Abs(j_end-j_start) %2 == 0) || (Math.Abs(i_end-i_start) %4 != 2 && Math.Abs(j_end-j_start) %2 != 0)) { Console.WriteLine("Impossible"); } else { int count = 0; List moves = new List(); while(true) { if(i_end < i_start && j_end <= j_start && j_start - 1 >= 0) { i_start -= 2; j_start--; moves.Add("UL"); } else if(i_end < i_start && j_end >= j_start && j_start + 1 <= n-1) { i_start -= 2; j_start++; moves.Add("UR"); } else if(i_end == i_start && j_end > j_start) { j_start += 2; moves.Add("R"); } else if(i_end > i_start && j_end >= j_start && j_start + 1 <= n-1) { i_start += 2; j_start++; moves.Add("LR"); } else if(i_end > i_start && j_end <= j_start && j_start - 1 >= 0) { i_start += 2; j_start--; moves.Add("LL"); } else if(i_end == i_start && j_end < j_start) { j_start -= 2; moves.Add("L"); } count++; if(i_start == i_end && j_start == j_end) { break; } } Console.WriteLine(count); foreach(var move in moves) { Console.Write(move + " "); } } } 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); } }