#!/bin/python import sys import collections def printShortestPath(n, i_start, j_start, i_end, j_end): # Print the distance along with the sequence of moves. moveNames = {(-2, -1): "UL", (-2, 1): "UR", (0, 2): "R", (2, 1): "LR", (2, -1): "LL", (0, -2): "L"} directions = moveNames.keys() dirIndex = {"UL": 0, "UR": 1, "R": 2, "LR": 3, "LL":4, "L":5} # bfs q = [(i_start, j_start)] visited = set((i_start, j_start)) dist = 0 movesMap = collections.defaultdict(list) found = False while q: nextQ = [] dist += 1 for i, j in q: if (i, j) in visited: continue visited.add((i, j)) for di, dj in directions: newI = i + di newJ = j + dj if (newI, newJ) in visited: continue # in bounds if 0 <= newI < n and 0 <= newJ < n: # visit next nextQ.append((newI, newJ)) curLen = len(movesMap[(newI, newJ)]) # save sequence of moves if curLen == 0: # copy moves up to the previous point for move in movesMap[(newI - di, newJ - dj)]: movesMap[(newI, newJ)].append(move) # add current move movesMap[(newI, newJ)].append(moveNames[(di, dj)]) elif curLen == dist: # generate new sequence of moves that is same length as old moves newMoves = [] for move in movesMap[(newI - di, newJ - dj)]: newMoves.append(move) newMoves.append(moveNames[(di, dj)]) # compare moves updateList = False oldMoves = movesMap[(newI, newJ)] for k in range(len(oldMoves)): priorityOld = dirIndex[oldMoves[k]] priorityNew = dirIndex[newMoves[k]] if priorityOld > priorityNew: updateList = True break elif priorityOld < priorityNew: break if updateList: movesMap[(newI, newJ)] = newMoves q = nextQ if (i_end, j_end) in q: found = True break if found: print dist print " ".join(movesMap[(i_end, j_end)]) else: print "Impossible" if __name__ == "__main__": n = int(raw_input().strip()) i_start, j_start, i_end, j_end = raw_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)