#include #define pb push_back #define mp make_pair #define int long long #define all(a) a.begin(), a.end() #define forlr(l, r) for(int i = (int)l; i <= (int)r; i++) #define forrl(l, r) for(int i = (int)r; i >= (int)l; i--) #define pii pair #define ld long double #define vii vector #define F first #define S second #define rev(a) reverse(all(a)) using namespace std; const int inf = 1e9; void solve() { int n, x, y, x1, y1, now = 0; cin >> n >> x >> y >> x1 >> y1; int ans[n][n]; queue > Q; int dist[n][n]; for(int i = 0; i < n; i++) { for(int j = 0; j < n; j++) { ans[i][j] = -1; dist[i][j] = inf; } } pair dir[6] = {{-2, -1}, {-2, 1}, {0, 2}, {2, 1}, {2, -1}, {0, -2}}; string let[6] = {"UL", "UR", "R", "LR", "LL", "L"}; dist[x][y] = 0; Q.push({x, y}); while (!Q.empty()) { pair tmp = Q.front(); Q.pop(); for(int i = 0; i < 6; i++) { if (tmp.F + dir[i].F >= 0 && tmp.F + dir[i].F < n && tmp.S + dir[i].S >= 0 && tmp.S + dir[i].S < n && dist[tmp.F + dir[i].F][tmp.S + dir[i].S] == inf) { Q.push({tmp.F + dir[i].F, tmp.S + dir[i].S}); dist[tmp.F + dir[i].F][tmp.S + dir[i].S] = dist[tmp.F][tmp.S] + 1; ans[tmp.F + dir[i].F][tmp.S + dir[i].S] = i; } } } vector answer; if(dist[x1][y1] < inf) { cout << dist[x1][y1] << "\n"; while (dist[x1][y1] != 0) { answer.pb(let[ans[x1][y1]]); int tmp = ans[x1][y1]; x1 -= dir[tmp].F; y1 -= dir[tmp].S; } rev(answer); for(int i = 0; i < answer.size(); i++) { cout << answer[i] << " "; } } else { cout << "Impossible"; } } signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t = 1; while(t--) { solve(); cout << "\n"; } return 0; }