process.stdin.resume(); process.stdin.setEncoding('ascii'); var input_stdin = ""; var input_stdin_array = ""; var input_currentline = 0; process.stdin.on('data', function (data) { input_stdin += data; }); process.stdin.on('end', function () { input_stdin_array = input_stdin.split("\n"); main(); }); function readLine() { return input_stdin_array[input_currentline++]; } /////////////// ignore above this line //////////////////// function printShortestPath(n, i_start, j_start, i_end, j_end) { // Print the distance along with the sequence of moves. const diffR = i_start - i_end; const diffL = j_end - j_start; if (Math.abs(diffR % 2) !== 0) { return { count: 'Impossible' }; } if (Math.abs(diffR % 4) === 2 && Math.abs(diffL % 2) !== 1) { return { count: 'Impossible' }; } if (Math.abs(diffR % 4) === 0 && Math.abs(diffL % 2) !== 0) { return { count: 'Impossible' }; } const horizontalSteps = Math.abs(diffR / 2); let steps = []; if (horizontalSteps <= Math.abs(diffL)) { if (diffR >= 0 && diffL >= 0) steps = [...steps, ...(new Array(horizontalSteps).fill('UR'))]; if (diffR < 0 && diffL >= 0) steps = [...steps, ...(new Array(horizontalSteps).fill('LR'))]; if (diffR >= 0 && diffL < 0) steps = [...steps, ...(new Array(horizontalSteps).fill('UL'))]; if (diffR < 0 && diffL < 0) steps = [...steps, ...(new Array(horizontalSteps).fill('LL'))]; const verticalSteps = (Math.abs(diffL) - horizontalSteps) / 2; if (diffL >= 0) steps = [...steps, ...(new Array(verticalSteps).fill('R'))]; if (diffL < 0) steps = [...steps, ...(new Array(verticalSteps).fill('L'))]; } if (horizontalSteps > Math.abs(diffL)) { const secondaryHorizontalSteps = (horizontalSteps - Math.abs(diffL)) / 2 const mainHorizontalSteps = horizontalSteps - secondaryHorizontalSteps; if (diffR >= 0 && diffL >= 0) { steps = [...steps, ...(new Array(mainHorizontalSteps).fill('UR'))]; steps = [...steps, ...(new Array(secondaryHorizontalSteps).fill('UL'))]; } if (diffR < 0 && diffL >= 0) { steps = [...steps, ...(new Array(mainHorizontalSteps).fill('LR'))]; steps = [...steps, ...(new Array(secondaryHorizontalSteps).fill('LL'))]; } if (diffR >= 0 && diffL < 0) { steps = [...steps, ...(new Array(mainHorizontalSteps).fill('UL'))]; steps = [...steps, ...(new Array(secondaryHorizontalSteps).fill('UR'))]; } if (diffR < 0 && diffL < 0) { steps = [...steps, ...(new Array(mainHorizontalSteps).fill('LL'))]; steps = [...steps, ...(new Array(secondaryHorizontalSteps).fill('LR'))]; } } const order = ['UL', 'UR', 'R', 'LR', 'LL', 'L']; steps.sort((step1, step2) => { const index1 = order.indexOf(step1); const index2 = order.indexOf(step2); return index1 - index2; }) return { count: steps.length, shortestPath: steps.join(' ') }; } function main() { var n = parseInt(readLine()); var i_start_temp = readLine().split(' '); var i_start = parseInt(i_start_temp[0]); var j_start = parseInt(i_start_temp[1]); var i_end = parseInt(i_start_temp[2]); var j_end = parseInt(i_start_temp[3]); const { count, shortestPath } = printShortestPath(n, i_start, j_start, i_end, j_end); console.log(count) if (shortestPath) console.log(shortestPath) }