#!/bin/python3 def getPath(n,i_start,j_start,i_end,j_end,steps,coords,move,foundmin=-1): steps.append(move) coords.append((i_start,j_start)) if move=="UL": new_i = i_start-2 new_j = j_start-1 elif move=="UR": new_i= i_start-2 new_j=j_start+1 elif move=="R": new_i=i_start new_j=j_start+2 elif move=="LR": new_i=i_start+2 new_j=j_start+1 elif move=="LL": new_i=i_start+2 new_j=j_start-1 elif move=="L": new_i=i_start new_j=j_start-2 if new_i<0 or new_i>n or new_j<0 or new_j>n: return (-1,steps,coords) if new_i==i_end and new_j==j_end: return (len(steps),steps,coords) for coord in coords: if coord[0]==new_i and coord[1]==new_j: return (-1,steps,coords) if foundmin!=-1 and len(steps)>foundmin: return(-1,steps,coords) foundpath=steps for m in ["UL","UR","R","LR","LL","L"]: steps1= steps[:] coords1=coords[:] path=getPath(n,new_i,new_j,i_end,j_end,steps1,coords1,m,foundmin) if path[0]!=-1: if foundmin!=-1: if path[0]0: print(foundmin) print(*foundpath,sep=" ") else: print("Impossible") 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)] printShortestPath(n, i_start, j_start, i_end, j_end)