#!/bin/python3 import sys import queue import copy def dentro(posicion, size): x= posicion[0] y= posicion[1] if x >= 0 and x <= size and y >= 0 and y <= size: return True return False def minSteps(inicial,objetivo, board_size): mov = [[-1,-2,"UL"],[1,-2,"UR"],[2,0,"R"],[-1,2,"LR"],[1,2,"LL"],[-2,0,"L"]] last_movements = queue.Queue() inicial.append(0) inicial.append([]) last_movements.put(inicial) ss= board_size+1 visitados = [[0]*ss for x in range(ss)] dist = 0 proximo=[0,0,0] while not last_movements.empty(): temp = last_movements.get() visitados[temp[0]][temp[1]] = 1 if temp[0] == objetivo[0] and temp[1] == objetivo[1]: return [temp[2], temp[3]] for pos in mov: proximo[0] = temp[0] + pos[0] proximo[1] = temp[1] + pos[1] if dentro(proximo,board_size) and visitados[proximo[0]][proximo[1]] == 0: temp[3].append(pos[2]) last_movements.put([proximo[0],proximo[1],temp[2]+1, copy.copy(temp[3])]) temp[3].pop() 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)] res= minSteps([j_start, i_start], [j_end, i_end], n) if res is not None: print(res[0]) s="" for x in range(0,len(res[1]),1): s+=res[1][x] s+=" " print(s) else: print("Impossible")