using System; using System.Collections.Generic; using System.IO; using System.Linq; class Solution { struct Point{ public int Column; public int Row; public Point(int row, int column){ this.Row=row; this.Column=column; } } static Point Compute(Point start,string command){ Point result = new Point(start.Row,start.Column); switch(command){ case "UL": result.Column--; result.Row-=2; break; case "UR": result.Column++; result.Row-=2; break; case "R" : result.Column+=2; break; case "LR": result.Column++; result.Row+=2; break; case "LL": result.Column--; result.Row+=2; break; case "L" : result.Column-=2; break; } return result; } 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. // UL, UR, R, LR, LL, L Point start = new Point(i_start,j_start); Point end = new Point(i_end,j_end); Point move = start; List path = new List(); bool inbounds = true; while(inbounds && !(move.Column==end.Column && move.Row==end.Row) && path.Count<= 200) { int deltax = end.Column-move.Column; int deltay = end.Row-move.Row; bool left= deltax < 0; bool right = deltax > 0; bool upper = deltay < 0; bool lower = deltay > 0; string command =string.Empty; if (upper && left){ command = "UL"; } else if (upper && right){ command = "UR"; } else if (lower && right){ command = "LR"; } else if (lower && left){ command = "LL"; } else if (right){ command = "R"; } else if (left){ command = "L"; } else if (upper){ command = "UL"; } else if (lower){ command = "LR"; } move = Compute(move, command); path.Add(command); inbounds = move.Column >=0 && move.Row >=0 && move.Column <= n-1 && move.Row <= n-1; } if (!inbounds || path.Count > 200) { Console.WriteLine("Impossible"); } else { Console.WriteLine(path.Count); Console.WriteLine(string.Join(" ",path)); } } 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); } }