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. var i_current = i_start; var j_current = j_start; var counter = 0; var seq = ''; // var seq2 = String(i_start) + ',' + String(j_start); while (i_current !== i_end || j_current !== j_end) { if (counter >= 10) break; var moved_ij = UL(i_current, j_current, n, i_end, j_end); if (moved_ij.moved) { i_current = moved_ij.i_new; j_current = moved_ij.j_new; seq = seq + 'UL '; counter++; // seq2 = seq2 + ' => ' + String(i_current) + ',' + String(j_current); } else { moved_ij = UR(i_current, j_current, n, i_end, j_end); if (moved_ij.moved) { i_current = moved_ij.i_new; j_current = moved_ij.j_new; seq = seq + 'UR '; counter++; // seq2 = seq2 + ' => ' + String(i_current) + ',' + String(j_current); } else { moved_ij = R(i_current, j_current, n, i_end, j_end); if (moved_ij.moved) { i_current = moved_ij.i_new; j_current = moved_ij.j_new; seq = seq + 'R '; counter++; // seq2 = seq2 + ' => ' + String(i_current) + ',' + String(j_current); } else { moved_ij = LR(i_current, j_current, n, i_end, j_end); if (moved_ij.moved) { i_current = moved_ij.i_new; j_current = moved_ij.j_new; seq = seq + 'LR '; counter++; // seq2 = seq2 + ' => ' + String(i_current) + ',' + String(j_current); } else { moved_ij = LL(i_current, j_current, n, i_end, j_end); if (moved_ij.moved) { i_current = moved_ij.i_new; j_current = moved_ij.j_new; seq = seq + 'LL '; counter++; // seq2 = seq2 + ' => ' + String(i_current) + ',' + String(j_current); } else { moved_ij = L(i_current, j_current, n, i_end, j_end); if (moved_ij.moved) { i_current = moved_ij.i_new; j_current = moved_ij.j_new; seq = seq + 'L '; counter++; // seq2 = seq2 + ' => ' + String(i_current) + ',' + String(j_current); } else { break; } } } } } } } if(i_current === i_end && j_current === j_end) process.stdout.write(counter + '\n' + seq /* + '\n' + seq2 */ ); else process.stdout.write('Impossible') } function UL(i_current, j_current, n, i_end, j_end) { if (i_current - 2 < 0 || j_current - 1 < 0) return {moved: false, i_new : i_current, j_new : j_current}; if ((i_current - i_end) <= 0 || (j_current - j_end) <= 0) return {moved: false, i_new : i_current, j_new : j_current}; return {moved: true, i_new : i_current - 2 , j_new : j_current - 1}; } function UR(i_current, j_current, n, i_end, j_end) { if (i_current - 2 < 0 || j_current + 1 >= n) return {moved: false, i_new : i_current, j_new : j_current}; if ((i_current - i_end) <= 0 || (j_current - j_end) > 0) return {moved: false, i_new : i_current, j_new : j_current}; return {moved: true, i_new : i_current - 2, j_new : j_current + 1}; } function R(i_current, j_current, n, i_end, j_end) { if (j_current + 2 >= n) return {moved: false, i_new : i_current, j_new : j_current}; if ((j_current - j_end) >= -1) return {moved: false, i_new : i_current, j_new : j_current}; return {moved: true, i_new : i_current, j_new : j_current + 2}; } function LR(i_current, j_current, n, i_end, j_end) { if (i_current + 2 >= n || j_current + 1 >= n) return {moved: false, i_new : i_current, j_new : j_current}; if ((i_current - i_end) >= 0 || (j_current - j_end) > 0) return {moved: false, i_new : i_current, j_new : j_current}; return {moved: true, i_new : i_current + 2 , j_new : j_current + 1}; } function LL(i_current, j_current, n, i_end, j_end) { if (i_current + 2 >= n || j_current - 1 < 0) return {moved: false, i_new : i_current, j_new : j_current}; if ((i_current - i_end) >= 0 || (j_current - j_end) < 0) return {moved: false, i_new : i_current, j_new : j_current}; return {moved: true, i_new : i_current + 2 , j_new : j_current - 1}; } function L(i_current, j_current, n, i_end, j_end) { if (j_current - 2 < 0) return {moved: false, i_new : i_current, j_new : j_current}; if ((j_current - j_end) <= 1) return {moved: false, i_new : i_current, j_new : j_current}; return {moved: true, i_new : i_current , j_new : j_current - 2}; } 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); }