#!/bin/python import sys def isEnd(i, j, i_end, j_end): return i == i_end and j == j_end def isSame(i, i_end): return i == i_end def isUpper(i, i_end): return i > i_end def isLeft(j, j_end): return j > j_end def isRight(j, j_end): return j < j_end def isImpossible(i, j, i_end, j_end): dist_i = abs(i_end - i) dist_j = abs(j_end - j) if dist_i % 2 == 1: return True if dist_i == 0 and dist_j % 2 == 1: return True return False def inRange(n, i, j): return 0 <= i < n and 0 <= j < n def withinLeftRight(j, j_end): dist_j = abs(j_end - j) if dist_j <= 2: return True else: return False def printShortestPath(n, i_start, j_start, i_end, j_end): # Print the distance along with the sequence of moves. . up = -2 lo = 2 st = 0 le = -1 ri = 1 ul = (up, le) ur = (up, ri) r = (st, ri*2) lr = (lo, ri) ll = (lo, le) l = (st, le*2) START = 1 END = 2 # grid = [[-1 for v in xrange(n)] for v in xrange(n)] # grid[i_start][j_start] = START # grid[i_end][j_end] = END curr_i, curr_j = i_start, j_start if isImpossible(curr_i, curr_j, i_end, j_end): print 'Impossible' else: count = 0 s = [] while not isEnd(curr_i, curr_j, i_end, j_end): if isUpper(curr_i, i_end): if isLeft(curr_j, j_end): curr_i += ul[0] curr_j += ul[1] s += ['UL'] elif isRight(curr_j, j_end): curr_i += ur[0] curr_j += ur[1] s += ['UR'] else: if not isLeft(curr_j, j_end) and inRange(n, curr_i, curr_j + r[1]) and not withinLeftRight(curr_j, j_end): curr_i += r[0] curr_j += r[1] s += ['R'] elif not isSame(curr_i, i_end) and (isRight(curr_j, j_end) or isSame(curr_j, j_end)): curr_i += lr[0] curr_j += lr[1] s += ['LR'] elif not isSame(curr_i, i_end) and isLeft(curr_j, j_end): curr_i += ll[0] curr_j += ll[1] s += ['LL'] else: curr_i += l[0] curr_j += l[1] s += ['L'] count += 1 print count print ' '.join(s) # UL, UR, R, LR, LL, L 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)