#!/bin/python3 import sys class Node: def __init__(self,present,parent): self.present=present self.parent = parent[:] def UL(self): self.present = [self.present[0]-1,self.present[1]-2] self.parent.append("UL") def UR(self): self.present = [self.present[0]+1,self.present[1]-2] self.parent.append("UR") def R(self): self.present = [self.present[0]+2,self.present[1]] self.parent.append("R") def LR(self): self.present = [self.present[0]+1,self.present[1]+2] self.parent.append("LR") def LL(self): self.present = [self.present[0]-1,self.present[1]+2] self.parent.append("LL") def L(self): self.present = [self.present[0]-2,self.present[1]] self.parent.append("L") def check(self,end): return self.present == end def boundary(self,visited,n): if(self.present[0] < 0 or self.present[1] < 0 or self.present[0] > n-1 or self.present[1] > n-1): return True elif(visited[self.present[1]][self.present[0]] == True): return True else: visited[self.present[1]][self.present[0]] = True return False def printShortestPath(n, i_start, j_start, i_end, j_end): # Print the distance along with the sequence of moves. end=[j_end,i_end] visited=dict() priority = {0:lambda x: x.UL(), 1:lambda x:x.UR(),2:lambda x:x.R(),3:lambda x:x.LR(),4:lambda x:x.LL(),5:lambda x:x.L() } for i in range(n): visited[i]=[False]*n queue=list() s=Node([j_start,i_start],[]) queue.append(s) visited[i_start][j_start] = True while queue: s=queue.pop(0) for i in range(6): x=Node(s.present,s.parent) priority[i](x) if(x.check(end)): return x.parent elif(x.boundary(visited,n)): continue queue.append(x) return ([]) def printd(li): if(len(li)==0): print("Impossible") else: print(len(li)) for i in li: print(i,end=' ') print(' ') 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)] printd(printShortestPath(n, i_start, j_start, i_end, j_end))