#include using namespace std; typedef pair point; const int Nmax = 200; int n, viz[Nmax][Nmax]; vector> mov = { {"UL", {-2, -1}}, {"UR", {-2, 1}}, {"R", {0, 2}}, {"LR", {2, 1}}, {"LL", {2, -1}}, {"L", {0, -2}}}; struct k_move { k_move *prev; point pnt; int lastmv; }; point perf(point p, pair m) { int fx = p.first + m.first; int fy = p.second + m.second; if (0 <= fx && fx < n) { if (0 <= fy && fy < n) { return {fx, fy}; } } return {-1, -1}; } queue q; k_move *printShortestPath(point x, point y) { q.push(new k_move{NULL, x, -1}); int found = 0; while (!found && !q.empty()) { k_move *p = q.front(); q.pop(); if (p->pnt == y) { return p; } for (int i = 0; i < mov.size(); i++) { auto &it = mov[i]; point to = perf(p->pnt, it.second); if(to.first == -1) { continue; } if (!viz[to.first][to.second]) { viz[to.first][to.second] = 1; q.push(new k_move{p, to, i}); } } } return NULL; } int main() { cin >> n; point x, y; cin >> x.first >> x.second; cin >> y.first >> y.second; k_move *p = printShortestPath(x, y); if(p == NULL) { cout<<"Impossible\n"; return 0; } vector sol; while (p->lastmv != -1) { sol.push_back(mov[p->lastmv].first); p = p->prev; } cout << sol.size() << '\n'; cout << sol[sol.size() - 1]; for (int i = sol.size() - 2; i >= 0; i--) { cout << ' ' << sol[i]; } cout << '\n'; return 0; }