#include using namespace std; using int64 = long long; const int vy[] = {-2, -2, 0, 2, 2, 0}; const int vx[] = {-1, 1, 2, 1, -1, -2}; const string vs[] = {"UL", "UR", "R", "LR", "LL", "L"}; int main() { int N, A, B, C, D; cin >> N; cin >> A >> B >> C >> D; int mat[200][200]; memset(mat, -1, sizeof(mat)); queue< pair< int, int > > que; que.emplace(C, D); mat[C][D] = 0; while(!que.empty()) { int y, x; tie(y, x) = que.front(); que.pop(); for(int i = 0; i < 6; i++) { int ny = y + vy[i], nx = x + vx[i]; if(ny < 0 || nx < 0 || ny >= N || nx >= N) continue; if(mat[ny][nx] != -1) continue; mat[ny][nx] = mat[y][x] + 1; que.emplace(ny, nx); } } if(mat[A][B] == -1) { cout << "Impossible" << endl; return (0); } cout << mat[A][B] << endl; bool first = false; while(A != C || B != D) { for(int i = 0; i < 6; i++) { int ny = A + vy[i], nx = B + vx[i]; if(ny < 0 || nx < 0 || ny >= N || nx >= N) continue; if(mat[ny][nx] + 1 == mat[A][B]) { A = ny; B = nx; if(first++) cout << " "; cout << vs[i]; break; } } } cout << endl; }