#!/bin/python3 from collections import deque, namedtuple Point = namedtuple('Point', ['x', 'y']) Path = namedtuple('Path', ['point', 'moves']) MOVES = ( ('UL', Point(-1, -2)), ('UR', Point(1, -2)), ('R', Point(2, 0)), ('LR', Point(1, 2)), ('LL', Point(-1, 2)), ('L', Point(-2, 0)) ) def valid_moves(size, start): valid = [] for (name, move) in MOVES: current = Point(start.x + move.x, start.y + move.y) if min(current.x, current.y) >= 0 and max(current.x, current.y) < size: valid.append((name, current)) return valid def find_shortest(size, start_y, start_x, end_y, end_x): routes = deque() visited = {} target = Point(end_x, end_y) current = Path(Point(start_x, start_y), []) while current.point != target: for (move, point) in valid_moves(size, current.point): previous = visited.get(point) if not previous or len(current.moves) < previous: routes.append(Path(point, current.moves + [move])) visited[point] = len(current.moves) if not routes: return current = routes.popleft() return current.moves def printShortestPath(size, start_y, start_x, end_y, end_x): path = find_shortest(size, start_y, start_x, end_y, end_x) if not path: print("Impossible") else: print(len(path)) print(' '.join(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)