#!/bin/python3 import sys def printShortestPath(n, i_start, j_start, i_end, j_end): seen = set() queue = [(0, i_start, j_start, [])] while queue: temp = [] while queue: count, i, j, steps = queue.pop() # out of bounds if i < 0 or i >= n or j < 0 or j >= n: continue # visited if (i, j) in seen: continue seen.add((i, j)) # found if i == i_end and j == j_end: print(count) print(" ".join(steps)) return count += 1 newsteps = steps[:] newsteps.append("UL") temp.append((count, i-2, j-1, newsteps)) newsteps = steps[:] newsteps.append("UR") temp.append((count, i-2, j+1, newsteps)) newsteps = steps[:] newsteps.append("R") temp.append((count, i, j+2, newsteps)) newsteps = steps[:] newsteps.append("LR") temp.append((count, i+2, j+1, newsteps)) newsteps = steps[:] newsteps.append("LL") temp.append((count, i+2, j-1, newsteps)) newsteps = steps[:] newsteps.append("L") temp.append((count, i, j-2, newsteps)) queue = list(reversed(temp)) 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)