#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; int parent[200][200]; int cost[200][200]; bool vis[200][200]; int main() { int n; scanf("%d", &n); int r1, c1, r2, c2; scanf("%d%d%d%d", &r1, &c1, &r2, &c2); string d[] = { "UL", "UR", "R", "LR", "LL", "L" }; int dr[6] = { 2,2, 0, -2,-2,0 }; int dc[6] = { 1,-1,-2,-1,1,2 }; queue > q; q.push({ r2,c2 }); vis[r2][c2] = true; parent[r2][c2] = -1; while (!q.empty()) { auto u = q.front(); q.pop(); int r = u.first; int c = u.second; for (int i = 0; i < 6; ++i) { int nr = r + dr[i]; int nc = c + dc[i]; if (nr < 0 || nr >= n || nc < 0 || nc >= n) continue; if (vis[nr][nc]) { if (cost[nr][nc] == cost[r][c] + 1) parent[nr][nc] = min(parent[nr][nc], i); continue; } cost[nr][nc] = cost[r][c] + 1; vis[nr][nc] = true; parent[nr][nc] = i; q.push({ nr,nc }); } } if (!vis[r1][c1]) { puts("Impossible"); return 0; } vector sol; while (parent[r1][c1] != -1) { int x = parent[r1][c1]; sol.push_back(d[x]); r1 -= dr[x]; c1 -= dc[x]; } printf("%d\n", sol.size()); for (int i = 0; i < sol.size(); ++i) { if (i) printf(" "); printf("%s", sol[i].c_str()); } puts(""); return 0; }