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 //////////////////// const _ = require('lodash'); function printShortestPath(n, i_start, j_start, i_end, j_end) { // Print the distance along with the sequence of moves. let result = ''; let dRow = i_end - i_start; let dCol = j_end - j_start; if (Math.abs(dRow) % 2 == 1) { result = 'Impossible'; } else if ((Math.abs(dRow) / 2) % 2 != Math.abs(dCol) % 2) { result = 'Impossible'; } else { const priorities = ['UL', 'UR', 'R', 'LR', 'LL', 'L']; let steps = _.mapValues(_.invert(priorities), () => 0); let stepCount = 0; let vDir, hDir; while (dRow != 0 || dCol != 0) { if (dRow > 0) { // Lo vDir = 'L'; dRow -= 2; if (dCol >= 0) { hDir = 'R'; dCol -= 1; } else { hDir = 'L'; dCol += 1; } } else if (dRow == 0) { vDir = ''; if (dCol >= 0) { hDir = 'R'; dCol -= 2; } else { hDir = 'L'; dCol += 2; } } else { // dRow < 0, Up vDir = 'U'; dRow += 2; if (dCol > 0) { hDir = 'R'; dCol -= 1; } else { hDir = 'L'; dCol += 1; } } steps[vDir + hDir]++; stepCount++; } let bestSteps = []; let col = j_start; while (stepCount > 0) { let hasStepsThisRun = false; let hasFailsThisRun = false; for (let k = 0; k < priorities.length; k++) { const dir = priorities[k]; if (steps[dir] > 0) { const stepCol = dir.length == 2 ? (dir[1] == 'L' ? -1 : 1) : (dir == 'L' ? -2 : 2); const nextCol = col + stepCol; if (nextCol >= 0 && nextCol < n) { // Step bestSteps.push(dir); stepCount--; steps[dir]--; col = nextCol; hasStepsThisRun = true; } } if (hasStepsThisRun) { // Try from highest priority again break; } } } result = bestSteps.length + '\n' + bestSteps.join(' '); } console.log(result); } 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]); printShortestPath(n, i_start, j_start, i_end, j_end); }