using System; using System.Collections.Generic; using System.Linq; using System.Text; class Solution { static int n; static int[,] distance; static Tuple[,] previous; static void Main(String[] args) { #if LOCAL Console.SetIn(new System.IO.StreamReader("input")); #endif n = int.Parse(Console.ReadLine()); var tmp = Console.ReadLine().Split(' '); int sx = int.Parse(tmp[0]); int sy = int.Parse(tmp[1]); int ex = int.Parse(tmp[2]); int ey = int.Parse(tmp[3]); Queue> Q = new Queue>(); Q.Enqueue(Tuple.Create(sx, sy)); distance = new int[n, n]; previous = new Tuple[n, n]; for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) distance[i, j] = int.MaxValue; distance[sx, sy] = 0; while (Q.Count > 0) { var cur = Q.Dequeue(); var d = 1 + distance[cur.Item1, cur.Item2]; foreach (var move in moves(cur.Item1, cur.Item2)) { if (distance[move.Item1, move.Item2] > d) { distance[move.Item1, move.Item2] = d; previous[move.Item1, move.Item2] = cur; Q.Enqueue(move); } } } if (distance[ex, ey] == int.MaxValue) { Console.WriteLine("Impossible"); } else { var path = new List(); var d = distance[ex, ey]; while (d > 0) { string k; Tuple m = _m(ex, ey, out k); path.Add(k); ex = m.Item1; ey = m.Item2; d--; } path.Reverse(); Console.WriteLine(path.Count); Console.WriteLine(String.Join(" ", path)); } } static string[] ss = new string[] { "UL", "UR", "R", "LR", "LL", "L" }; private static Tuple _m(int ex, int ey, out string k) { var all = allMoveds(ex, ey); for (int i = 0; i < ss.Length; i++) { if (all[i].Equals(previous[ex, ey])) { k = ss[i]; return all[i]; } } k = ""; return null; } static List> allMoveds(int x, int y) { List> all = new List> { Tuple.Create(x+2,y+1), Tuple.Create(x+2,y-1), Tuple.Create(x,y-2), Tuple.Create(x-2,y-1), Tuple.Create(x-2,y+1), Tuple.Create(x,y+2) }; return all; } static IEnumerable> moves(int x, int y) { var all = new List> { Tuple.Create(x-2,y-1), Tuple.Create(x-2,y+1), Tuple.Create(x,y+2), Tuple.Create(x+2,y+1), Tuple.Create(x+2,y-1), Tuple.Create(x,y-2) }; foreach (var item in all) { if (valid(item)) yield return item; } } private static bool valid(Tuple item) { return item.Item1 >= 0 && item.Item1 < n && item.Item2 >= 0 && item.Item2 < n; } }