#include #define taskname "test" #define x first #define y second using namespace std; typedef long long LL; typedef pair PII; const int maxn = 200 + 7; int n; PII s, t; bool found; int f[maxn][maxn]; int dx[6] = {-2,-2, 0,+2,+2, 0}; int dy[6] = {-1,+1,+2,+1,-1,-2}; string st[6] = {"UL", "UR", "R", "LR", "LL", "L"}; bool vs[maxn][maxn]; int trace[maxn][maxn]; queue que; vector ans; template inline void read(T &x){ x = 0; char ch; int positive = 1; while (!isdigit(ch = getchar())) if (ch == '-') positive = 0; do x = x * 10 + ch - '0'; while (isdigit(ch = getchar())); if (!positive) x = -x; } void input() { read(n); read(s.x);read(s.y);read(t.x);read(t.y); ++s.x;++s.y;++t.x;++t.y; } void push(int x, int y, int k, int z) { if (!(1 <= x && x <= n && 1 <= y && y <= n)) return; if (vs[x][y]) return; else vs[x][y] = true; que.push({x, y}); f[x][y] = z; trace[x][y] = k; } void solve() { push(s.x, s.y, 0, 0); while (!que.empty()) { PII q = que.front(); if (q.x == t.x && q.y == t.y) { found = true; break; } que.pop(); for(int k = 0; k < 6; ++k) push(q.x + dx[k], q.y + dy[k], k, f[q.x][q.y] + 1); } if (!found) { puts("Impossible"); return; } int u = t.x, v = t.y; while (u != s.x || v != s.y) { int k = trace[u][v]; ans.push_back(k); u -= dx[k]; v -= dy[k]; } printf("%d\n", ans.size()); for(int i = ans.size() - 1; i >= 0; --i) cout << st[ans[i]] << " "; } int main() { //freopen(taskname".inp","r",stdin); //freopen(taskname".out","w",stdout); input(); solve(); return 0; }