using System; using System.Collections.Generic; using System.IO; using System.Linq; class Solution { static void printMoves(int moves, List moveNames) { Console.WriteLine(moves); foreach (string str in moveNames) { Console.Write("{0} ", str); } } static void printShortestPath(int n, int i_start, int j_start, int i_end, int j_end) { int moves = 0; List moveNames = new List(); //where is the end while (true) { int y = i_end - i_start; int x = j_end - j_start; //X>0 R ---- X<0 Left if (y > 0) //Low { if (x > 0) { moveNames.Add("LR"); i_start += 2; j_start += 1; moves++; } else if (x == 0) { Console.WriteLine("Impossible"); return; } else if (x < 0) { moveNames.Add("LL"); i_start += 2; j_start -= 1; moves++; } } else if (y == 0)//No U or Low { if (x > 0) { moveNames.Add("R"); moves++; printMoves(moves, moveNames); return; } else if (x == 0) { printMoves(moves, moveNames); return; } else if (x < 0) { moveNames.Add("L"); moves++; printMoves(moves, moveNames); return; } } else if (y < 0)//Up { if (x > 0) { moveNames.Add("UR"); i_start -= 2; j_start += 1; moves++; } else if (x == 0) { Console.WriteLine("Impossible"); return; } else if (x < 0) { moveNames.Add("UL"); i_start -= 2; j_start -= 1; moves++; } } } } 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); } }