#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define f first #define s second #define pb push_back #define mp make_pair #define ll long long #define pii pair < int, int > #define pll pair < long long, long long> #define ull unsigned long long #define y1 stupid_cmath #define left stupid_left #define right stupid_right #define vi vector #define sz(a) (int)a.size() #define forit(it, s) for(__typeof(s.begin()) it = s.begin(); it != s.end(); it++) #define all(a) a.begin(), a.end() #define sqr(x) ((x) * (x)) const int inf = (int)1e9; const int mod = inf + 7; const double eps = 1e-9; const double pi = acos(-1.0); ll read_long() { ll ans = 0; char c; bool started = false; bool is_negative = false; while (true) { c = getchar(); if ((c < '0' || c > '9') && c != '-' && !started) continue; if ((c < '0' || c > '9') && c != '-' && started) break; if (started) { ans = ans * 10; } started = true; if (c == '-') is_negative = true; else ans += c - '0'; } if (is_negative) ans *= -1; return ans; } int n, x1, y1, x2, y2; pii par[222][222]; int dp[222][222]; queue q; string name[6] = {"UL", "UR", "R", "LR", "LL", "L"}; int dx[6] = {-2, -2, 0, 2, 2, 0}; int dy[6] = {-1, 1, 2, 1, -1, -2}; bool ok(int x, int y) { return x >= 0 && x < n && y >= 0 && y < n; } string get(int x1, int y1, int x2, int y2) { int x = x2 - x1; int y = y2 - y1; for (int i = 0; i < 6; i++) { if (x == dx[i] && y == dy[i]) return name[i]; } return ""; } int main(){ cin >> n >> x1 >> y1 >> x2 >> y2; memset(dp, -1, sizeof dp); dp[x2][y2] = 0; q.push(mp(x2, y2)); memset(par, -1, sizeof par); par[x2][y2] = mp(-1, -1); while (!q.empty()) { pii p = q.front(); q.pop(); for (int i = 0; i < 6; i++) { int x = dx[i] + p.f; int y = dy[i] + p.s; if (ok(x, y) && dp[x][y] == -1) { q.push(mp(x, y)); par[x][y] = p; dp[x][y] = dp[p.f][p.s] + 1; } } } if (dp[x1][y1] == -1) { printf("Impossible\n"); return 0; } int len = dp[x1][y1]; printf("%d\n", len); for (int i = 0; i < len; i++) { int cur = dp[x1][y1]; int j = 0; while (j < 6) { int x = x1 + dx[j]; int y = y1 + dy[j]; if (ok(x, y) && dp[x][y] + 1 == cur) { break; } j++; } cout << name[j] << " "; x1 += dx[j]; y1 += dy[j]; } cout << endl; return 0; }