#!/bin/python3 import sys from collections import deque def printShortestPath(n, i_start, j_start, i_end, j_end): dp = [[(None, float('inf')) for i in range(n)] for _ in range(n)] count = 0 movei = [-2, -2, 0, 2, 2, 0] movej = [-1, 1, 2, 1, -1, -2] word = ['UL', 'UR', 'R', 'LR', 'LL', 'L'] bfs = deque() bfs.append((i_start, j_start)) dp[i_start][j_start] = ("", 0) while len(bfs) > 0: i, j = bfs.popleft() chars = dp[i][j][0] for index in range(len(word)): newindexi, newindexj, count = i + movei[index], j + movej[index], dp[i][j][1] + 1 if newindexi >= 0 and newindexi < n and newindexj >= 0 and newindexj < n: if dp[newindexi][newindexj][1] > count: dp[newindexi][newindexj] = (chars + str(index), count) bfs.append((newindexi, newindexj)) elif dp[newindexi][newindexj][1] == count: if (chars + str(index)) < dp[newindexi][newindexj][0]: dp[newindexi][newindexj] = (chars + str(index), count) bfs.append((newindexi, newindexj)) if dp[i_end][j_end][0] == None: print("Impossible") else: print(dp[i_end][j_end][1]) for i in dp[i_end][j_end][0]: print(word[int(i)], end = " ") if __name__ == "__main__": n = int(input().strip()) i_start, j_start, i_end, j_end = input().strip().split(' ') i_start, j_start, i_end, j_end = [int(i_start), int(j_start), int(i_end), int(j_end)] printShortestPath(n, i_start, j_start, i_end, j_end)