#!/bin/python3 import sys import math from collections import namedtuple Pos = namedtuple('pos', 'x y name') def allowed_positions(center, min_ij, max_ij): UL = Pos(center.x - 2, center.y - 1, 'UL') UR = Pos(center.x - 2, center.y + 1, 'UR') R = Pos(center.x, center.y + 2, 'R') LR = Pos(center.x + 2, center.y + 1, 'LR') LL = Pos(center.x + 2, center.y - 1, 'LL') L = Pos(center.x, center.y - 2, 'L') out = [] for i in (UL, UR, R, LR, LL, L): if i.x < 0 or i.y < 0 or i.x > max_ij or i.y > max_ij: continue out.append(i) return out def distance(pos1, pos2): return math.sqrt(math.pow(pos1.x - pos2.x, 2) + math.pow(pos1.y - pos2.y, 2)) def get_closer(center, end, n, previous_distance): starting_pos = Pos(center.x, center.y, 'center') min_dist = 99999 for p in allowed_positions(center, 0, n): if p.x == end.x and p.y == end.y: return p, 0.0 current_dist = distance(p, end) if current_dist < min_dist: min_dist = current_dist starting_pos = p if current_dist > previous_distance: current_dist = -1 return starting_pos, current_dist def same_pos(p1, p2): return p1.x == p2.x and p1.y == p2.y def printShortestPath(n, i_start, j_start, i_end, j_end): # Print the distance along with the sequence of moves. starting_pos = Pos(i_start, j_start, 'center') end_pos = Pos(i_end, j_end, 'end') # nothing to do if same_pos(starting_pos, end_pos): return distance = 9999999 path = [] next_pos = starting_pos while distance > 2: next_pos, distance = get_closer(next_pos, end_pos, n, distance) path.append(next_pos.name) if distance == 0.0: print('{}\n{}'.format(len(path), ' '.join(path))) return else: print('Impossible') return 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)