#include using namespace std; const int N = 200; bool visit[N + 1][N + 1]; int dist[N + 1][N + 1]; struct Pair { int x, y; }; const int dir[6][2] = {{-2, -1}, {-2, 1}, {0, 2}, {2, 1}, {2, -1}, {0, -2}}; // reversed labels const string labels[6] = {"UL", "UR", "R", "LR", "LL", "L"}; void printShortestPath(int n, int i_start, int j_start, int i_end, int j_end) { // Print the distance along with the sequence of moves. auto valid = [&](int x, int y) { return x >= 0 && x < n && y >= 0 && y < n; }; memset(dist, 0, sizeof dist); queue q; q.push({i_end, j_end}); dist[i_end][j_end] = 1; while (!q.empty()) { Pair p = q.front(); q.pop(); for (int i = 0; i < 6; ++i) { int x = p.x + dir[i][0], y = p.y + dir[i][1]; if (!valid(x, y) || dist[x][y] != 0) continue; dist[x][y] = dist[p.x][p.y] + 1; q.push({x, y}); } } if (dist[i_start][j_start] == 0) { cout << "Impossible" << endl; return; } vector path; int x = i_start, y = j_start, d = dist[i_start][j_start]; while (x != i_end || y != j_end) { for (int i = 0; i < 6; ++i) { int nx = x + dir[i][0], ny = y + dir[i][1]; if (valid(nx, ny) && dist[nx][ny] == d - 1) { x = nx, y = ny, --d; path.push_back(labels[i]); break; } } } cout << path.size() << endl; for (auto &x : path) cout << x << " "; cout << endl; } int main() { int n; cin >> n; int i_start; int j_start; int i_end; int j_end; cin >> i_start >> j_start >> i_end >> j_end; printShortestPath(n, i_start, j_start, i_end, j_end); return 0; }