#include using namespace std; typedef long long ll; typedef pair P; int dx[6] = { -1, 1, 2, 1, -1, -2 }; int dy[6] = { -2, -2, 0, 2, 2, 0 }; string s[6] = { "UL", "UR", "R", "LR", "LL", "L" }; int dist[200][200]; P prepos[200][200]; int pre[200][200]; int n; bool In(int x, int y){ return 0 <= x && x < n && 0 <= y && y < n; } int main(){ cin.tie(0); ios::sync_with_stdio(false); #ifdef LOCAL std::ifstream in("in"); std::cin.rdbuf(in.rdbuf()); #endif cin >> n; int sx, sy, gx, gy; cin >> sy >> sx >> gy >> gx; memset(pre, -1, sizeof pre); fill((int*)begin(dist), (int*)end(dist), 1e9); dist[sy][sx] = 0; queue

q; q.push({ sx, sy }); while(q.size()){ int x, y; tie(x, y) = q.front(); q.pop(); for(int i = 0; i < 6; i++){ int nx = x + dx[i], ny = y + dy[i]; if(!In(nx, ny)) continue; if(dist[ny][nx] > dist[y][x] + 1){ dist[ny][nx] = dist[y][x] + 1; pre[ny][nx] = i; prepos[ny][nx] = { x, y }; q.push({ nx, ny }); } } } if(dist[gy][gx] == 1e9) cout << "Impossible" << endl; else{ cout << dist[gy][gx] << endl; vector ans; while(pre[gy][gx] != -1){ ans.push_back(s[pre[gy][gx]]); tie(gx, gy) = prepos[gy][gx]; } reverse(ans.begin(), ans.end()); for(auto ss : ans){ cout << ss << " "; } } }