#!/bin/python import sys from collections import deque def add_pos_points(n, i, j, q, visited): # priority of UL, UR, R, LR, LL, L # UL if j - 1 >= 0 and i - 2 >= 0 and (i-2, j-1) not in visited: q.append((i-2, j-1)) visited[(i-2, j-1)] = visited[(i, j)] + 'UL ' # UR if j + 1 < n and i - 2 >= 0 and (i-2, j+1) not in visited: q.append((i-2, j+1)) visited[(i-2, j+1)] = visited[(i, j)] + 'UR ' # R if j + 2 < n and (i, j+2) not in visited: q.append((i, j+2)) visited[(i, j+2)] = visited[(i, j)] + 'R ' # LR if j + 1 < n and i + 2 < n and (i+2, j+1) not in visited: q.append((i+2, j+1)) visited[(i+2, j+1)] = visited[(i, j)] + 'LR ' # LL if j - 1 >= 0 and i + 2 < n and (i+2, j-1) not in visited: q.append((i+2, j-1)) visited[(i+2, j-1)] = visited[(i, j)] + 'LL ' # L if j - 2 >= 0 and (i, j-2) not in visited: q.append((i, j-2)) visited[(i, j-2)] = visited[(i, j)] + 'L ' return q def printShortestPath(n, i_start, j_start, i_end, j_end): # Print the distance along with the sequence of moves. if i_start == i_end and j_start == j_end: print("0") print() end_point = (i_end, j_end) # implement shortest path using a queue q = deque([(i_start, j_start)]) # implement a visited dictionary to store # {tile : path} visited = {(i_start, j_start) : ''} while q != deque([]): # get a point new_point = q.popleft() # if end point print it! if new_point[0] == end_point[0] and \ new_point[1] == end_point[1]: # print length of path: print(len(str.split(visited[new_point], " ")) - 1) # print path print(visited[new_point]) return # if not find all the next possible points q = add_pos_points(n, new_point[0], new_point[1], q, visited) 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)