DIR_TO_MOVENAME = { ('up','left') : ('UL', (-2, -1)), ('up','right') : ('UR', (-2, +1)), ('same','left') : ('L', (0, -2)), ('same','right') : ('R', (0, +2)), ('down','left') : ('LL', (+2, -1)), ('down','right') : ('LR', (+2, +1)), } def printShortestPath(n, i_start, j_start, i_end, j_end): if isImpossible(i_start, j_start, i_end, j_end): print 'Impossible' return i_current = i_start j_current = j_start stepCount = 0 steps = [] while i_current != i_end or j_current != j_end: if i_current > i_end: upDown = 'up' elif i_current < i_end: upDown = 'down' else: upDown = 'same' if j_current < j_end: leftRight = 'right' elif j_current > j_end: leftRight = 'left' else: if j_current == 0: leftRight = 'right' elif j_current >= n-1: leftRight = 'left' else: if upDown == 'up': leftRight = 'left' else: leftRight = 'right' posName, delta = DIR_TO_MOVENAME[(upDown, leftRight)] stepCount += 1 steps.append(posName) i_current += delta[0] j_current += delta[1] if j_current < 0 or j_current >= n: print ('Impossible') return print stepCount print ' '.join(sortList(steps)) def sortList(lst): from collections import defaultdict d = defaultdict(lambda : 0) for i in lst: d[i] += 1 resulting = [] for i in ['UL', 'UR', 'R', 'LR', 'LL', 'L']: resulting.extend( [i] * d[i] ) return resulting def isImpossible(i_start, j_start, i_end, j_end): return not ( isValidLine(i_start, i_end) and isValidCol(i_start, j_start, i_end, j_end) ) def isValidLine(i_start, i_end): return (i_start % 2) == (i_end % 2) def isValidCol(i_start, j_start, i_end, j_end): if (i_start % 4) == (i_end % 4): return (j_start % 2) == (j_end % 2) else: return (j_start % 2) != (j_end % 2) 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)