#!/bin/python3 import sys def distance(i_start,j_start,i_end,j_end): #print('distance',i_start,j_start,i_end,j_end) if min(i_start,j_start,i_end,j_end) < 0 or max(i_start,j_start,i_end,j_end) >= n: return -1 fieldsDown = abs(i_end - i_start) fieldsRight = abs(j_end - j_start) if fieldsDown + fieldsRight == 0: return 0 if fieldsDown % 2 == 1: return -1 stepsDown = fieldsDown//2 if ((stepsDown+fieldsRight) % 2 == 1): return -1 #print('stepsDown',stepsDown) #print('fieldsRight',fieldsRight) secondSummand = max([0,(fieldsRight - stepsDown)//2]) #print('secondSummand',secondSummand) return stepsDown + secondSummand def solve(i_start,j_start,i_end,j_end): steps = [] d = distance(i_start,j_start,i_end,j_end) if d == -1: print('Impossible') return else: print(d) moves = [['UL',-2,-1],['UR',-2,1],['R',0,2],['LR',2,1],['LL',2,-1],['L',0,-2]] while d != 0: for m in moves: #print('checking',m) newD = distance(i_start+m[1],j_start+m[2],i_end,j_end) #print(newD) if newD != -1 and newD < d: i_start += m[1] j_start += m[2] d = newD steps.append(m[0]) #print(d,'steps left after',m[0]) break #print(len(steps)) print(' '.join(steps)) def printShortestPath(n, i_start, j_start, i_end, j_end): # Print the distance along with the sequence of moves. solve(i_start, j_start, i_end, j_end) 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)