#include using namespace std; typedef long long LL; #define FOR(i, x, y) for (decay::type i = (x), _##i = (y); i < _##i; ++i) #define FORD(i, x, y) for (decay::type i = (x), _##i = (y); i > _##i; --i) #ifdef zerol #define dbg(args...) do { cout << "\033[32;1m" << #args<< " -> "; err(args); } while (0) #else #define dbg(...) #endif void err() { cout << "\033[39;0m" << endl; } template void err(T a, Args... args) { cout << a << ' '; err(args...); } // ----------------------------------------------------------------------------- const int DIR[6][2] = {{-1, -2}, {1, -2}, {2, 0}, {1, 2}, {-1, 2}, {-2, 0}}; const string C[6] = {"UL", "UR", "R", "LR", "LL", "L"}; const int maxn = 200 + 5; struct P { int x, y, d, fx, fy, dir; }; bool vis[maxn][maxn], flag; queue

q; int edX, edY, stX, stY, n; int fx[maxn][maxn], fy[maxn][maxn], dir[maxn][maxn]; int main() { cin >> n >> stX >> stY >> edX >> edY; swap(stX, stY); swap(edX, edY); q.push({stX, stY, 0, -1, -1, 0}); while (!q.empty()) { P p = q.front(); q.pop(); int x = p.x, y = p.y; dbg(x, y); if (vis[x][y]) continue; fx[x][y] = p.fx; fy[x][y] = p.fy; dir[x][y] = p.dir; vis[x][y] = true; if (x == edX && y == edY) { flag = true; cout << p.d << endl; break; } FOR (k, 0, 6) { int xx = x + DIR[k][0], yy = y + DIR[k][1]; if (xx < 0 || yy < 0 || xx >= n || yy >= n) continue; q.push({xx, yy, p.d + 1, x, y, k}); } } if (!flag) { puts("Impossible"); return 0; } vector ans; int x = edX, y = edY; while (x != -1) { ans.push_back(dir[x][y]); int xx = fx[x][y], yy = fy[x][y]; x = xx; y = yy; } FORD (i, (int)ans.size() - 2, -1) cout << C[ans[i]] << (i == _i + 1 ? '\n' : ' '); }