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 //////////////////// var visited = {}; var lessMovs = Infinity; var lessPath = []; function posibleMove(pos,size, direction){ switch(direction){ case 0: // UL return !visited[(pos.x - 1) + '-'+ (pos.y - 2)] && pos.x - 1 >= 0 && pos.x - 1 < size && pos.y - 2 >= 0 && pos.y - 2 < size case 1: //UR return !visited[(pos.x + 1) + '-'+ (pos.y - 2)] && pos.x + 1 >= 0 && pos.x + 1 < size && pos.y - 2 >= 0 && pos.y - 2 < size case 2: //R return !visited[(pos.x + 2) + '-'+ (pos.y)] && pos.x + 2 < size; case 3: //LR return !visited[(pos.x + 1) + '-'+ (pos.y + 2)] && pos.x + 1 >= 0 && pos.x + 1 < size && pos.y + 2 >= 0 && pos.y + 2 < size case 4: //LL return !visited[(pos.x - 1) + '-'+ (pos.y + 2)] && pos.x - 1 >= 0 && pos.x - 1 < size && pos.y + 2 >= 0 && pos.y + 2 < size case 5: //L return !visited[(pos.x - 2) + '-'+ (pos.y)] && pos.x - 2 >= 0; } } var callstack = 0; function printShortestPath(size, pos, end, path, movs) { //console.log(callstack++, path, visited) visited[pos.x + '-'+ pos.y] = true; if(pos.x == end.x && end.y == pos.y) { // console.log(movs, path) visited[pos.x + '-'+ pos.y] = false; if(movs < lessMovs){ lessMovs = movs; lessPath = path.slice(0); } } //Move UL if(posibleMove(pos, size, 0)){ pos.x -= 1; pos.y -= 2; path.push('UL'); movs++; printShortestPath(size, pos, end, path, movs); pos.x += 1; pos.y += 2; path.pop(); movs--; } //Move UR if(posibleMove(pos, size, 1)){ pos.x += 1; pos.y -= 2; path.push('UR'); movs++; printShortestPath(size, pos, end, path, movs); pos.x -= 1; pos.y += 2; path.pop(); movs--; } //Move R if(posibleMove(pos, size, 2)){ pos.x += 2; path.push('R'); movs++; printShortestPath(size, pos, end, path, movs); pos.x -= 2; path.pop(); movs--; } //Move LR if(posibleMove(pos, size, 3)){ pos.x += 1; pos.y += 2; path.push('LR'); movs++; printShortestPath(size, pos, end, path, movs); pos.x -= 1; pos.y -= 2; path.pop(); movs--; } //Move LL if(posibleMove(pos, size, 4)){ pos.x -= 1; pos.y += 2; path.push('LL'); movs++; printShortestPath(size, pos, end, path, movs); pos.x += 1; pos.y -= 2; path.pop(); movs--; } //Move L if(posibleMove(pos, size, 5)){ pos.x -= 2; path.push('L'); movs++; printShortestPath(size, pos, end, path, movs); pos.x += 2; path.pop(); movs--; } } 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, {y:i_start, x:j_start},{y: i_end,x: j_end},[],0); if(lessMovs == Infinity){ console.log("Impossible") } else { console.log(lessMovs+'\n'+lessPath.join(' ')) } }