#include #include using namespace std; int n; int y1, x1, y2, x2; int g[300][300]; vector> v; int py[300][300], px[300][300]; string f[300][300]; int main() { cin >> n; cin >> y1 >> x1 >> y2 >> x2; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { g[i][j] = 1e9; } } g[y1][x1] = 0; v.push_back({y1,x1}); int xx[] = {-1,1,2,1,-1,-2}; int yy[] = {-2,-2,0,2,2,0}; string ss[] = {"UL","UR","R","LR","LL","L"}; for (int i = 0; i < v.size(); i++) { int cc = g[v[i].first][v[i].second]; for (int j = 0; j < 6; j++) { int uy = v[i].first+yy[j]; int ux = v[i].second+xx[j]; if (uy < 0 || uy >= n || ux < 0 || ux >= n) continue; if (cc+1 >= g[uy][ux]) continue; g[uy][ux] = cc+1; py[uy][ux] = v[i].first; px[uy][ux] = v[i].second; f[uy][ux] = ss[j]; v.push_back({uy,ux}); } } if (g[y2][x2] == 1e9) { cout << "Impossible\n"; return 0; } cout << g[y2][x2] << "\n"; vector vv; int uy = y2, ux = x2; while (f[uy][ux] != "") { vv.push_back(f[uy][ux]); int vy = uy, vx = ux; uy = py[vy][vx]; ux = px[vy][vx]; } for (int i = vv.size()-1; i >= 0; i--) cout << vv[i] << " "; cout << "\n"; }