#!/bin/python3 import sys offsets = ( ("UL", (-1, -2)), ("UR", (1, -2)), ("R", (2, 0)), ("LR", (1, 2)), ("LL", (-1, 2)), ("L", (-2, 0)), ) def is_valid(x, n): return 0 <= x < n def find_shortest_path(n, i_start, j_start, i_end, j_end, used_vertexes): start_valid = is_valid(i_start, n) and is_valid(j_start, n) if not start_valid: return None if (i_start, j_start) == (i_end, j_end): return [] best_turn, best_path = None, None for turn, offset in offsets: i_next, j_next = i_start + offset[1], j_start + offset[0] if (i_next, j_next) not in used_vertexes: used_copy = used_vertexes.copy() used_copy.add((i_start, j_start)) path = find_shortest_path(n, i_next, j_next, i_end, j_end, used_copy) if path is not None and (best_path is None or len(path) < len(best_path)): best_turn = turn best_path = path if best_turn is not None: return [best_turn] + best_path return None def printShortestPath(n, i_start, j_start, i_end, j_end): used_vertexes = set() path = find_shortest_path(n, i_start, j_start, i_end, j_end, used_vertexes) if path is None: print("Impossible") else: print(len(path)) print(" ".join(map(str, path))) 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)