#!/bin/python3 import sys def options(n, tup): options = [] i = tup[0] j = tup[1] if i-2>=0: if j-1>=0: options.append((i-2,j-1)) #UL if j+1=0: options.append((i+2,j-1)) #LL if j-2>=0: options.append((i,j-2)) #L return options def whatMove(cur, prev): di = cur[0] - prev[0] dj = cur[1] - prev[1] if(di == 0): if (dj==-2): return "L" if (dj==2): return "R" if(di == -2): if (dj==-1): return "UL" if (dj==1): return "UR" if(di==2): if (dj==-1): return "LL" if (dj==1): return "LR" def printShortestPath(n, i_start, j_start, i_end, j_end): # Print the distance along with the sequence of moves. prev = {} visited = [] queue = [(i_start, j_start)] while(queue): current = queue.pop(0) visited.append(current) if current == (i_end, j_end): #print result path = [] while current!=(i_start,j_start): parent = prev[current] path.append(whatMove(current, parent)) current = parent print(len(path)) path.reverse() print(*path) return for option in options(n, current): if option not in visited and option not in queue: prev[option] = current queue.append(option) 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)