#!/bin/python3 import sys def printShortestPath(n, i_start, j_start, i_end, j_end): # Print the distance along with the sequence of moves. y_dist = i_start - i_end x_dist = j_start - j_end # will append moves later moves = "" num_moves = 0 # short grid to explain moves: (these are wrong) # UL -> x_dist -2, y_dist -1 # UR -> x_dist -2, y_dist +1 # R -> x_diist +0, y_dist +2 # LR -> x_dist +2, y_dist +1 # LL -> x_dist +2, y_dist -1 # L -> x_dist +0, y_dist -2 # ######## # exclude if distance in x is uneven; this can never be solved. if (abs(y_dist)%2 == 1): print("Impossible") # we now know already that a path must exist. else: temp_x = '' temp_y = '' while (x_dist != 0 or y_dist != 0): # for k in range(4): if (x_dist>0): temp_x = 'L' elif (x_dist<0): temp_x = 'R' elif (x_dist == 0 and y_dist != 0): temp_x = 'R' if (y_dist>0): temp_y = 'U' elif (y_dist < 0): temp_y = 'L' elif (y_dist == 0): temp_y = '' # build moves from temp indicators. temp_move = temp_y+temp_x if (temp_move == "UL"): x_dist -= 1 y_dist -= 2 elif (temp_move == "UR"): x_dist += 1 y_dist -= 2 elif (temp_move == "R"): x_dist += 2 y_dist -= 0 elif (temp_move == "LR"): x_dist += 1 y_dist += 2 elif (temp_move == "LL"): x_dist -= 1 y_dist += 2 elif (temp_move == "L"): x_dist -= 2 y_dist -= 0 moves += temp_move + " " num_moves += 1 print(num_moves) 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)