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, y_start, x_start, y_end, x_end) { let [x, y, steps] = [x_start, y_start, []] if (Math.abs(y_start - y_end) % 2 == 1) return 'Impossible' if (y >= y_end) { while(y !== y_end) { if (x < x_end) { steps.push('UR') x++ y -= 2 } else if (x > x_end) { steps.push('UL') x-- y -= 2 } else if ((x === x_end) && (x === 0)) { steps.push('UR') x++ y -= 2 } else if ((x === x_end) && (x === n - 1)) { steps.push('UL') x-- y -= 2 } else if (x === x_end) { steps.push('UL') x-- y -= 2 } } if (Math.abs(x - x_end) % 2 == 1) return 'Impossible' while(x !== x_end) { if (x < x_end) { steps.push('R') x += 2 } else { steps.push('L') x -= 2 } } } if (y < y_end) { let special = [] while(y !== y_end) { if (x < x_end) { steps.push('LR') x++ y += 2 } else if (x > x_end) { steps.push('LL') x-- y += 2 } else if ((x === x_end) && (x === 0)) { steps.push('LR') x++ y += 2 } else if ((x === x_end) && (x === n - 1)) { steps.push('LL') x-- y += 2 } else if (x === x_end) { steps.push('LR') x++ y += 2 } } if (Math.abs(x - x_end) % 2 == 1) return 'Impossible' while(x !== x_end) { if (x < x_end) { special.push('R') x += 2 } else { steps.push('L') x -= 2 } } steps = special.concat(steps) } let [ul, ur, r, lr, ll, l] = [[],[],[],[],[],[]] steps.forEach(el => { switch(el) { case 'UL': ul.push('UL'); break case 'UR': ur.push('UR'); break case 'R': r.push('R'); break case 'LR': lr.push('LR'); break case 'LL': ll.push('LL'); break case 'L': l.push('L'); } }) steps = ul.concat(ur.concat(r.concat(lr.concat(ll.concat(l))))) return `${steps.length}\n${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]); console.log(printShortestPath(n, i_start, j_start, i_end, j_end)) }