#!/bin/python3 import sys def printShortestPath(n, i_start, j_start, i_end, j_end): # red knight only jumps to odd rows beginning at start row - impossible # ur - 2 row up 1 right, ul - 2 row up 1 left, lr - 2 row down - 1 right, ul - 2 row down 1 left, l - 2 left, r - 2 right distanced_rows = abs(i_start - i_end) distanced_columns = abs(j_start - j_end) impossible = False finished = False steps = [] preferences = ["UL", "UR", "R", "LR", "LL", "L"] first = range(n)[-1] last = 0 chess_board = [[i for i in range(n)]for j in range(n)] while not impossible and not finished: # going upwards if i_start > i_end: if j_start > j_end: steps.append("UL") j_start -= 1 elif j_start < j_end: steps.append("UR") j_start += 1 elif distanced_columns == 0: if distanced_columns > 0: steps.append("UL") j_start -= 1 elif distanced_columns < range(n)[-1]: steps.append("UR") j_start += 1 i_start -= 2 # going downwards if i_start < i_end: if j_start > j_end: steps.append("LL") j_start -= 1 elif j_start < j_end: steps.append("LR") j_start += 1 elif distanced_columns == 0: if distanced_columns > range(n)[0]: steps.append("LL") j_start -= 1 elif distanced_columns < range(n)[-1]: steps.append("LR") j_start += 1 i_start += 2 # reached target row if distanced_rows == 0: if j_start > j_end: steps.append("L") j_start -= 2 elif j_start < j_end: steps.append("R") j_start += 2 if distanced_columns == 0 and distanced_rows == 0: finished = True if distanced_rows == 1: impossible = True distanced_rows = i_start - i_end distanced_columns = j_start - j_end if impossible: print("Impossible") else: print(str(len(steps)) + "\n" + " ".join(map(str, steps))) 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)