#include #define _USE_MATH_DEFINES #define ll long long #define ins Not Needed Thing #define ull unsigned long long #define ld long double #define Accepted 0 #define pb push_back #define pii pair #define pll pair #define mp make_pair #define sz(x) (int)(x.size()) #define all(x) x.begin(),x.end() #define F first #define S second #define emp What is it #define SORRY FUL Accepted #define dimash the top one #define I wish #define you be a little more calm #define SpeedForce ios_base::sync_with_stdio(0), cin.tie(0) using namespace std; const double eps = 0.000001; const ld pi = acos(-1); const int maxn = 1e7 + 9; const int mod = 1e9 + 7; const ll MOD = 1e18 + 9; const ll INF = 1e18 + 123; const int inf = 2e9 + 11; const int mxn = 1e6 + 9; const int N = 5e3 + 123; const int NN = 5e5 + 123; const int PRI = 555557; const int pri = 997; int tests = 1; int n; int dp[202][202]; pair p[202][202]; string tt[] = {"UL", "UR", "R", "LR", "LL", "L"}; int type[202][202]; int dx[] = {-2, -2, 0, 2, 2, 0}; int dy[] = {-1, 1, 2, 1, -1, -2}; queue > q; inline void Solve () { // easy cin >> n; n --; for (int i = 0; i <= n; i ++) { for (int j = 0; j <= n; j ++) dp[i][j] = 1e9; } int sti, stj, eni, enj; cin >> sti >> stj >> eni >> enj; dp[sti][stj] = 0; q.push(mp(sti, stj)); while(q.size()) { pii v = q.front(); q.pop(); int i = v.F, j = v.S; for (int c = 0; c < 6; c ++) { int ni = i + dx[c]; int nj = j + dy[c]; if (ni < 0 || ni > n) continue; if (nj < 0 || ni > n) continue; if(dp[ni][nj] > dp[i][j] + 1) { p[ni][nj] = mp(i, j); type[ni][nj] = c; dp[ni][nj] = dp[i][j] + 1; q.push(mp(ni, nj)); } } } if(dp[eni][enj] == 1e9) { cout << "Impossible"; exit(0); } cout << dp[eni][enj] << '\n'; pii pr = mp(eni, enj); vector ans; while (pr != mp(sti, stj)) { ans.pb(type[pr.F][pr.S]); pr = p[pr.F][pr.S]; } reverse(ans.begin(), ans.end()); for (int i = 0; i < ans.size(); i ++) cout << tt[ans[i]] << ' '; } int main () { SpeedForce; // freopen(".in", "r", stdin); // freopen(".out", "w", stdout); // cin >> tests; while(tests --) { Solve (); // Ee Zadrot } }