#!/bin/python import sys ORDER = [("UL",-2,-1), ("UR",-2,1), ("R",0,2), ("LR", 2, 1), ("LL",2,-1),("L",0,-2)] def pathCmpFunc(p1, p2): if len(p1) != len(p2): return len(p1) - len(p2) priority = map(lambda x:x[0], ORDER) for x,y in zip(p1, p2): if x == y: continue return priority.index(x) - priority.index(y) return 0 def printShortestPath(n, i_start, j_start, i_end, j_end): # Print the distance along with the sequence of moves. path = bfs(n, i_start, j_start, i_end, j_end) # path_list.sort(cmp=pathCmpFunc) if path: print len(path) print " ".join(path) else: print "Impossible" def bfs(n, i_start, j_start, i_end, j_end): queue = [(i_start, j_start,[])] status = [[False for j in range(n)] for i in range(n)] while queue: i,j,path = queue.pop(0) status[i][j] = True for d, x, y in ORDER: if i+x >= 0 and i+x < n and j+y >=0 and j+y < n and not status[i+x][j+y]: if i+x==i_end and j+y==j_end: return path+[d] else: queue.append((i+x, j+y, path+[d])) 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)