#!/bin/python3 import sys def printShortestPath(n, i_start, j_start, i_end, j_end): g = [ [0 for c in range(n)] for r in range(n) ] li, lj = i_start, j_start if i_start > i_end: while li >= i_end: for j in range(lj, n, 2): g[li][j] = 1 for j in range(lj, -1, -2): g[li][j] = 1 if j-1 >= 0: li,lj = li - 2,j-1 elif j+1 < n: li,lj = li - 2,j+1 elif i_start < i_end: while li <= i_end: for j in range(lj, n, 2): g[li][j] = 1 for j in range(lj, -1, -2): g[li][j] = 1 if lj-1 >= 0: li,lj = li + 2,j-1 elif lj+1 < n: li,lj = li + 2,j+1 if g[i_end][j_end] == 0: print("Impossible") else: c_i,c_j = i_start,j_start count = 0 moves = "" if i_start > i_end: while c_i != i_end or c_j != j_end: if c_i > i_end: if c_j >= j_end: if IsUL(g,c_i,c_j): c_i -= 2 c_j -= 1 count += 1 moves = moves + "UL " else: c_i -= 2 c_j += 1 count += 1 moves = moves + "UR " elif c_j < j_end: if IsUR(g,c_i,c_j): c_i -= 2 c_j += 1 count += 1 moves = moves + "UR " else: c_i -= 2 c_j -= 1 count += 1 moves = moves + "UL " elif c_i == i_end: if c_j < j_end: c_j += 2 count += 1 moves = moves + "R " else: c_j -= 2 count += 1 moves = moves + "L " elif i_start < i_end: while c_i != i_end or c_j != j_end: if c_i < i_end: if c_j <= j_end: if IsLR(g,c_i,c_j): c_i += 2 c_j += 1 count += 1 moves = moves + "LR " else: c_i += 2 c_j -= 1 count += 1 moves = moves + "LL " elif c_j > j_end: if IsLL(g,c_i,c_j): c_i += 2 c_j -= 1 count += 1 moves = moves + "LL " else: c_i += 2 c_j += 1 count += 1 moves = moves + "LR " elif c_i == i_end: if c_j < j_end: c_j += 2 count += 1 moves = moves + "R " else: c_j -= 2 count += 1 moves = moves + "L " elif i_start == i_end: if c_j < j_end: c_j += 2 count += 1 moves = moves + "R " else: c_j -= 2 count += 1 moves = moves + "L " print(count) print(moves) def IsUL(g,c_i,c_j): if c_i - 2 >= 0 and c_j - 1 >= 0: if g[c_i-2][c_j-1] == 1: return True else: return False def IsUR(g,c_i,c_j): if c_i - 2 >= 0 and c_j + 1 < n: if g[c_i-2][c_j+1] == 1: return True else: return False def IsLR(g,c_i,c_j): if c_i + 2 < n and c_j + 1 < n: if g[c_i + 2][c_j + 1] == 1: return True else: return False def IsLL(g,c_i,c_j): if c_i + 2 < n and c_j - 1 >= 0: if g[c_i+2][c_j-1] == 1: return True else: return False def IsR(g,c_i,c_j): if c_j + 2 < n: if g[c_i][c_j+2] == 1: return True else: return False def IsL(g,c_i,c_j): if c_j - 2 >= 0: if g[c_i][c_j-2] == 1: return True else: return False 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)