#!/bin/python3 import sys def get_next(i, j, i_end, j_end, n): # prio UL, UR, R, LR, LL, L vector = [(i - 2, j - 1, 'UL'), (i - 2, j + 1, 'UR'), (i , j + 2, 'R'), (i + 2, j + 1, 'LR'), (i + 2, j - 1, 'LL'), (i , j - 2, 'L')] path_values = [] for i in range(len(vector)): if vector[i][0] >= n or vector[i][1] >= n or vector[i][0] < 0 or vector[i][1] < 0: path_values.append(n*n*n) else: path_values.append(abs(vector[i][0] - i_end) + abs(vector[i][1] - j_end)) min_v = path_values.index(min(path_values)) return vector[min_v] def printShortestPath(n, i_start, j_start, i_end, j_end): # Print the distance along with the sequence of moves. if i_start % 2 != i_end % 2: print("Impossible") return else: if j_start % 2 == j_end % 2: if i_start % 4 != i_end % 4: print("Impossible") return else: if i_start % 4 == i_end % 4: print("Impossible") return # start the path abs_x = abs(j_start - j_end) abs_y = abs(i_start - i_end) path = [] i = 0 if (abs_x + abs_y) == 0: path = ['UL', 'LR'] while abs_x + abs_y > 0: i_start, j_start, p = get_next(i_start, j_start, i_end, j_end, n) path.append(p) abs_x = abs(j_start - j_end) abs_y = abs(i_start - i_end) string = "" for i in path: string += i + ' ' print(len(path)) print(string) 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)