### IMPORTS ### import math ### INPUTS ### dim = int(input()) sJ, sI, eJ, eI = map(int,input().split()) bot = (sI, sJ) point = (eI, eJ) arr = [(-1, 2), (1, 2), (-2, 0), (2, 0), (-1, -2), (1, -2)] values = ['LL', 'LR', 'L', 'R', 'UL', 'UR'] moves = list(zip(values, arr)) prior = dict(zip(['UL', 'UR', 'R', 'LR', 'LL', 'L'], list(range(1,7)))) ordering = [] ### FUNCTIONS ### def manhattan(bot, point): return math.sqrt((bot[0] - point[0]) ** 2 + (bot[1] - point[1]) ** 2) def optim(arr): temp = {} for i in arr: try: x = (bot[0] + i[1][0], bot[1] + i[1][1]) temp[i[0]] = x except: pass optimumValue = min(manhattan(temp[k], point) for k in temp) priority = {i: j for i,j in temp.items() if manhattan(j,point) == optimumValue} val = min(priority, key=lambda k: prior[k]) return val, temp[val] ### OUTPUTS ### repeats = set() flag = False while bot != point: val, bot = optim(moves) ordering.append(val) if bot not in repeats: repeats.add(bot) else: flag = True break #print(bot) if flag: print("Impossible") else: print(len(ordering)) output = sorted(ordering, key = lambda k: prior[k]) print(*output)