#!/bin/python import sys from collections import deque from collections import defaultdict moves = {"UL": (-2, -1), "UR": (-2, 1), "R": (0, 2), "LR": (2, 1), "LL": (2, -1), "L": (0, -2)} moveKeys = ["UL", "UR", "R", "LR", "LL", "L"] def move(p, m): i, j = p di, dj = moves[m] return i + di, j + dj def valid(p, n): i, j = p return 0 <= i < n and 0 <= j < n def dist(p1, p2): i1, j1 = p1 i2, j2 = p2 return abs(i1 - i2) + abs(j1 - j2) def printShortestPath(n, i_start, j_start, i_end, j_end): # Print the distance along with the sequence of moves. Q = deque() Q.append(((i_start, j_start), 0, [])) done = defaultdict(bool) done[(i_start, j_start)] = True foundD = -1 foundMs = [] while len(Q) > 0: p, d, ms = Q.popleft() if p == (i_end, j_end): foundD = d foundMs = ms break for m in moveKeys: newP = move(p, m) if not valid(newP, n): continue if done[newP]: continue done[newP] = True Q.append((newP, d+1, ms + [m])) if foundD == -1: print "Impossible" else: print foundD print " ".join(foundMs) 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)