from collections import deque, defaultdict def calc_pos(move, x_pos, y_pos): if move == 'UL': return x_pos-2, y_pos-1 if move == 'UR': return x_pos - 2, y_pos + 1 if move == 'R': return x_pos, y_pos + 2 if move == 'LR': return x_pos + 2, y_pos + 1 if move == 'LL': return x_pos + 2, y_pos - 1 if move == 'L': return x_pos , y_pos - 2 def bfs(a,x_s, y_s, x_e, y_e, visit): prev = defaultdict() moves = ['UL', 'UR', 'R', 'LR', 'LL', 'L'] queue = deque() queue.append((x_s,y_s)) visit[x_s][y_s] = True data[x_s][y_s] = 0 while queue: x_s, y_s = queue.popleft() if x_s == y_s and x_e == y_e: return prev for k in moves: if is_safe(k, x_s, y_s, visit): a,b = calc_pos(k, x_s, y_s) data[a][b] = data[x_s][y_s] + 1 prev[(a,b)] = [[x_s, y_s],k] queue.append((a,b)) visit[a][b] = True return prev def is_safe(mov, i, j, visit): i,j = calc_pos(mov, i, j) if n > i >= 0 and n > j >= 0 and visit[i][j] == False: return True return False n = int(input()) x_start, y_start, x_end, y_end = map(int, input().split()) data = [[0 for i in range(n)]for j in range(n)] visit = [[False for i in range(n)]for j in range(n)] prevv = bfs(data, x_start, y_start, x_end, y_end, visit) if data[x_end][y_end] != 0: print(data[x_end][y_end]) ans = [] while not (x_start == x_end and y_start == y_end): ans.append(prevv[(x_end, y_end)][1]) x_end, y_end = prevv[(x_end, y_end)][0] for i in range(1, len(ans)+1): print(ans[-i], end= " ") else: print('Impossible')