#include #define fn1 "" using namespace std; const int mn = 2 * int(1e2) + 10; const int mod = 1 * int(1e5) + 10; const int mm = 1 * int(1e5) + 10; int tt, ntest = 1; int tr[mn][mn], ok[mn][mn]; int mx[6] = {- 2, -2, 0, 2, 2, 0}; int my[6] = {- 1, 1, 2, 1, - 1, - 2}; int n, xs, xe, ye, ys; string s[6] = {"UL", "UR", "R", "LR", "LL", "L"}; void docfile() { ios::sync_with_stdio(false); cin.tie(nullptr); if (ifstream("test.inp")) { freopen("test.inp", "r", stdin); freopen("test.out", "w", stdout); }else if (ifstream(fn1".inp")) { freopen(fn1".inp", "r", stdin); freopen(fn1".out", "w", stdout); } } template inline void read(T& x) { x = 0; T f = 1; char ch = getchar(); while (!isdigit(ch)) f = ch == '-' ? - f : f, ch = getchar(); while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar(); x *= f; } template inline void write(T a) { int i = 0; char S[20]; if (a == 0) {putchar('0'); return;} while(a > 0) { S[i++] = a % 10 + '0'; a /= 10; } --i; while(i >= 0) putchar(S[i--]); } void enter() { cin >> n; cin >> xs >> ys >> xe >> ye; } bool kt (int x, int y) { return (x >= 0 && x <= n && y >= 0 && y <= n); } void solve() { ok[xs][ys] = 1; queue > qu; qu.push({xs, ys}); while (qu.size()) { int x = qu.front().first, y = qu.front().second; qu.pop(); if (x == xe && y == ye) { cout << ok[x][y] - 1 << "\n"; vector v; while (!(x == xs && y == ys)) { v.push_back(s[tr[x][y]]); int X = x - mx[tr[x][y]], Y = y - my[tr[x][y]]; x = X; y = Y; } reverse(v.begin(), v.end()); for (string x : v) cout << x << " "; return; } for (int k = 0; k < 6; ++ k) { int X = x + mx[k], Y = y + my[k]; if (kt (X, Y) && !ok[X][Y]) { ok[X][Y] = ok[x][y] + 1; tr[X][Y] = k; qu.push({X, Y}); } } } cout << "Impossible"; } void print_result() { } int main() { docfile(); //cin>>ntest; for (tt = 1; tt <= ntest; ++ tt) { enter(); solve(); print_result(); } }