__author__ = 'Tola' from collections import deque import sys def printShortestPath(n, i_start, j_start, i_end, j_end, queue, state): # Print the distance along with the sequence of moves. # order => UL(x - 1, y - 2); UR(x + 1, y -2); R(x + 2, y); LR(x + 1, y + 2); LL(x - 1, y + 2); L(x - 2, y) while True: if len(queue) == 0: break current = queue.popleft() i_s, j_s, moves = current #UL if 0 <= i_s - 2 < n and 0 <= j_s - 1 < n and state[i_s - 2][j_s - 1]: state[i_s - 2][j_s - 1] = False if i_s - 2 == i_end and j_s - 1 == j_end: return moves + ["UL"] queue.append([i_s - 2, j_s - 1, moves + ["UL"]]) #UR if 0 <= i_s - 2 < n and 0 <= j_s + 1 < n and state[i_s - 2][j_s + 1]: state[i_s - 2][j_s + 1] = False if i_s - 2 == i_end and j_s + 1 == j_end: return moves + ["UR"] queue.append([i_s - 2, j_s + 1, moves + ["UR"]]) #R if 0 <= j_s + 2 < n and state[i_s][j_s + 2]: state[i_s][j_s + 2] = False if i_s == i_end and j_s + 2 == j_end: return moves + ["R"] queue.append([i_s, j_s + 2, moves + ["R"]]) #LR if 0 <= i_s + 2 < n and 0 <= j_s + 1 < n and state[i_s + 2][j_s + 1]: state[i_s + 2][j_s + 1] = False if i_s + 2 == i_end and j_s + 1 == j_end: return moves + ["LR"] queue.append([i_s + 2, j_s + 1, moves + ["LR"]]) #LL if 0 <= i_s + 2 < n and 0 <= j_s - 1 < n and state[i_s + 2][j_s - 1]: state[i_s + 2][j_s - 1] = False if i_s + 2 == i_end and j_s - 1 == j_end: return moves + ["LL"] queue.append([i_s + 2, j_s - 1, moves + ["LL"]]) #L if 0 <= j_s - 2 < n and state[i_s][j_s - 2]: state[i_s][j_s - 2] = False if i_s == i_end and j_s - 2 == j_end: return moves + ["L"] queue.append([i_s, j_s - 2, moves + ["L"]]) 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)] state = [[True] * n for i in range(n)] # True => not occuppied queue = deque([[i_start, j_start, []]]) state[i_start][j_start] = False retVal = printShortestPath(n, i_start, j_start, i_end, j_end, queue, state) if retVal: print(len(retVal)) print(" ".join(retVal)) else: print("Impossible")