#!/bin/python3 import sys def printShortestPath(n, i_start, j_start, i_end, j_end): # Print the distance along with the sequence of moves. v = [[False for i in range(n)] for j in range(n)] v[i_start][j_start] = True p = [[(-1,-1) for i in range(n)] for j in range(n)] m = [["" for i in range(n)] for j in range(n)] q = [(i_start, j_start)] while q: curr = q.pop(0) if curr[0] == i_end and curr[1] == j_end: break if curr[0]-2>=0 and curr[1]-1>=0 and v[curr[0]-2][curr[1]-1] == False: v[curr[0]-2][curr[1]-1] = True p[curr[0]-2][curr[1]-1] = curr m[curr[0]-2][curr[1]-1] = "UL" q.append((curr[0]-2,curr[1]-1)) if curr[0]-2>=0 and curr[1]+1=0 and v[curr[0]+2][curr[1]-1] == False: v[curr[0]+2][curr[1]-1] = True p[curr[0]+2][curr[1]-1] = curr m[curr[0]+2][curr[1]-1] = "LL" q.append((curr[0]+2,curr[1]-1)) if curr[1]-2>=0 and v[curr[0]][curr[1]-2] == False: v[curr[0]][curr[1]-2] = True p[curr[0]][curr[1]-2] = curr m[curr[0]][curr[1]-2] = "L" q.append((curr[0],curr[1]-2)) if v[i_end][j_end] == False or (i_start, j_start)==(i_end, j_end): print("Impossible") else: len_path = 0 moves = "" end = p[i_end][j_end] i = i_end j = j_end while p[i][j] != (-1,-1): if len_path == 0: mid = "" else: mid = " " moves = m[i][j]+mid+moves tmp_i = p[i][j][0] tmp_j = p[i][j][1] i = tmp_i j = tmp_j len_path+=1 print(len_path) print(moves) 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)