#include using namespace std; const int dx[] = {-2, -2, 0, 2, 2, 0}; const int dy[] = {-1, 1, 2, 1, -1, -2}; const string s[] = {"UL", "UR", "R", "LR", "LL", "L"}; void printShortestPath(int n, int i_start, int j_start, int i_end, int j_end) { vector> d(n, vector(n, -1)); vector> p(n, vector(n, -1)); queue q; q.push(i_start); q.push(j_start); d[i_start][j_start] = 0; while (!q.empty()) { int x = q.front(); q.pop(); int y = q.front(); q.pop(); for(int i = 0; i < 6; ++i) { int tox = x + dx[i]; int toy = y + dy[i]; if (tox < 0 || toy < 0 || tox >= n || toy >= n) continue; if (d[tox][toy] != -1) continue; d[tox][toy] = d[x][y] + 1; p[tox][toy] = i; q.push(tox); q.push(toy); } } if (d[i_end][j_end] == -1) cout << "Impossible\n"; else { int x = i_end; int y = j_end; cout << d[i_end][j_end] << '\n'; vector res; for(int i = 0; i < d[i_end][j_end]; ++i) { cerr << x << ' ' << y << endl; int tox = x - dx[p[x][y]]; int toy = y - dy[p[x][y]]; res.push_back(s[p[x][y]]); x = tox; y = toy; } reverse(res.begin(), res.end()); for(auto & w : res) cout << w << ' '; cout << '\n'; } } 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; }