#include using namespace std; #define N 310 #define Inf N * N int pa[N * N]; int vis[N][N]; int dx[] = {-1, 1, 2, 1, -1, -2}; int dy[] = {-2, -2, 0, 2, 2, 0}; typedef pair pii; char mov[][10] = {"UL", "UR", "R", "LR", "LL", "L"}; queue q; int position[N * N]; int main() { //freopen("1.in", "r", stdin); int n, enx, eny, stx, sty; scanf("%d", &n); scanf("%d%d%d%d", &sty, &stx, &eny, &enx); while(!q.empty()) { q.pop(); } for(int i = 0; i < n; i ++) for(int j = 0; j < n; j ++) vis[i][j] = Inf; vis[stx][sty] = 0; q.push(pii(stx, sty)); while(!q.empty()) { pii curr = q.front(); q.pop(); int val = vis[curr.first][curr.second]; for(int i = 0; i < 6; i ++) { int x = curr.first + dx[i]; int y = curr.second + dy[i]; if(x < 0 || y < 0 || x >= n || y >= n) { continue; } if(vis[x][y] < Inf) continue; vis[x][y] = val + 1; pa[x * n + y] = i; q.push(pii(x, y)); } } if(vis[enx][eny] == Inf) { puts("Impossible"); return 0; } printf("%d\n", vis[enx][eny]); int curr_x = enx; int curr_y = eny; int curr_pos = 0; while(curr_x != stx || curr_y != sty) { int id = pa[curr_x * n + curr_y]; position[curr_pos ++] = id; curr_x -= dx[id]; curr_y -= dy[id]; } for(int i = curr_pos - 1; i >= 0; i --) { int val = position[i]; printf("%s ", mov[val]); } puts(""); }