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, r_start, c_start, r_end, c_end) { // Print the distance along with the sequence of moves. var rowDiff = Math.abs(r_start - r_end); var colDiff = Math.abs(c_start - c_end); var rowMove = Math.floor(rowDiff/2); var colMove = 0; var L = 0; var R = 0; var UL = 0; var UR = 0; var LL = 0; var LR = 0; /* Check destination */ if (rowDiff%2 == 0) { /* Possible */ if (c_start > c_end) { if (r_start < r_end) { /* 3 Quadrant */ colMove = Math.abs(c_start - rowMove - c_end)/2; if (!Number.isInteger(colMove)) console.log("Impossible"); else { LL += rowMove; L += colMove; } } else if (r_start == r_end) { /* left axis x */ colMove = Math.abs(c_start-c_end)/2; if (!Number.isInteger(colMove)) console.log("Impossible"); else L += colMove; } else { /* 2 Quadrant */ colMove = Math.abs(c_start - rowMove - c_end)/2; if (!Number.isInteger(colMove)) console.log("Impossible"); else { UL += rowMove; L += colMove; } } } else if (c_start == c_end) { /* Axis y */ if (r_start < r_end) { /* Down */ rowMove = rowDiff/4; if (!Number.isInteger(rowMove)) console.log("Impossible"); else { LR += rowMove; LL += rowMove; } } else if (r_start == r_end) { /* It's me */ rowMove = 0; colMove = 0; } else { /* Up */ rowMove = rowMove/2; if (!Number.isInteger(rowMove)) console.log("Impossible"); else { UL += rowMove; UR += rowMove; } } } else { if (r_start < r_end) { /* 4 Quadrant */ colMove = Math.abs(c_start + rowMove - c_end)/2; if (!Number.isInteger(colMove)) console.log("Impossible"); else { LR += rowMove; R += colMove; } } else if (r_start == r_end) { /* right axis x */ colMove = Math.abs(c_start-c_end)/2; if (!Number.isInteger(colMove)) console.log("Impossible"); else R += colMove; } else { /* 1 Quadrant */ colMove = Math.abs(c_start + rowMove - c_end)/2; if (!Number.isInteger(colMove)) console.log("Impossible"); else { UR += rowMove; R += colMove; } } } printPath(L, R, UL, UR, LL, LR); } else { console.log("Impossible"); } //console.log("L=", L, "R=", R, "UL=", UL, "UR=", UR, "LL=", LL, "LR=", LR); } function printPath(L, R, UL, UR, LL, LR) { console.log(L+R+UL+UR+LL+LR); /* Priority: UL, UR, R, LR, LL, L */ let str = ""; if (UL != 0) { while (UL-->0) str += "UL "; } if (UR != 0) { while (UR-->0) str += "UR "; } if (R != 0) { while (R-->0) str += "R "; } if (LR != 0) { while (LR-->0) str += "LR "; } if (LL != 0) { while (LL-->0) str += "LL "; } if (L != 0) { while(L-->0) str += "L"; } console.log(str); } 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); }