/// Bismillahir Rahmanir Rahim /// S. M. Shakir Ahsan Romeo #include //#include //#include using namespace std; //using namespace __gnu_pbds; const double PI = acos(-1.0); typedef long long lng; typedef unsigned long long ulng; typedef double db; typedef pair < int, int > pii; typedef vector < pii > vpii; //typedef tree < int, null_type, less < int >, rb_tree_tag, tree_order_statistics_node_update > ordered_set; inline int getint() { int x; scanf("%d", &x); return x; } #define II getint() inline long long getlng() { long long x; scanf("%lld", &x); return x; } #define LL getlng() int dx4[] = {-1, 0, 1, 0}; int dy4[] = {0, 1, 0, -1}; int dx8[] = {-1, -1, -1, 0, 0, 1, 1, 1}; int dy8[] = {-1, 0, 1, -1, 1, -1, 0, 1}; #define theromeo421 main() #define segtree int lft = node << 1, rgt = lft | 1, mid = (b + e) >> 1; #define mem(x, y) memset((x), (y), sizeof (x)); #define sz(x) ((int)x.size()) #define max3(a,b,c) max(a, max(b,c)) #define min3(a,b,c) min(a, min(b,c)) #define pr1(x) cout << x << endl #define pr2(x,y) cout << x << ' ' << y << endl #define rep(i, n) for(int i = 0; i < n; ++i) #define rep1(i, n) for(int i = 1; i <= n; ++i) #define repstl(it, x) for(auto it = x.begin(); it != x.end(); it++) #define forcon(pp , qq) for(const auto& pp : qq) #define all(x) (x).begin(), (x).end() #define Unique(x) sort(all(x)); x.erase(unique(all(x)), x.end()); /// x needs to be sorted first #define pb push_back #define wait system("pause") #define xx first #define yy second #define dbg(x) cerr << #x << "=" << x << endl; #define dbg2(x, y) cerr << #x << "=" << x << ", " << #y << "=" << y << endl; #define read(a) freopen(a, "r", stdin); #define write(a) freopen(a, "w", stdout); #define prv(v) rep(i, sz(v)) cout << v[i] << " \n"[i + 1 == v.size()]; #define pf printf #define sf scanf #define MP make_pair #define endl '\n' const double eps = (double)1e-9; int DX[] = {-2, -2, 0, 2, 2, 0}; int DY[] = {-1, 1, 2, 1, -1, -2}; string D[] = {"UL", "UR", "R", "LR", "LL", "L"}; int n, si, sj, ei, ej; map < pii , bool > vis; map < pii , int > dis; map < pii , pii > par; map < pii , string > dir; bool bfs() { queue < pii > Q; Q.push(MP(si, sj)); vis[MP(si, sj)] = true; while(!Q.empty()) { pii u = Q.front(); Q.pop(); rep(k, 6) { pii v = MP(u.xx + DX[k], u.yy + DY[k]); if(v.xx < 0 || v.xx >= n || v.yy < 0 || v.yy >= n) continue; if(!vis[v]) { vis[v] = true; dis[v] = dis[u] + 1; Q.push(v); par[v] = u; dir[v] = D[k]; if(v.xx == ei && v.yy == ej) return true; } } } return false; } vector < string > ans; void fun(int i, int j) { pii w = MP(i, j); ans.pb(dir[w]); if(i == si && j == sj) return; fun(par[w].xx, par[w].yy); } int theromeo421 { cin >> n >> si >> sj >> ei >> ej; if(si == ei && sj == ej) { cout << 0 << endl; return 0; } if(!bfs()) puts("Impossible"); else { pii v = MP(ei, ej); cout << dis[v] << endl; fun(ei, ej); reverse(all(ans)); for(int i = 1; i < sz(ans); ++i) { if(i > 1) pf(" "); pf("%s", ans[i].c_str()); } pf("\n"); } return 0; }