#include using namespace std; typedef pair pii; typedef pair pip; #define x first #define y second #define mp make_pair const int N = 205; pii flag[N][N]; string fk[N][N]; int n; pii s, e; bool check(pii now) { return (now.x >= 0 && now.x < n && now.y >= 0 && now.y < n && (flag[now.x][now.y].x == -1)); } queue q; void insert(int px, int py, int xx, int yy, int dd, string fkX) { if (check(mp(xx, yy))) { fk[xx][yy] = fkX; flag[xx][yy] = mp(px, py); q.push(mp(dd + 1, mp(xx, yy))); } } int main() { for(int i = 0; i < N; i++) { for(int j = 0; j < N; j++) { flag[i][j].x = -1; } } scanf("%d",&n); scanf("%d %d %d %d",&s.x, &s.y, &e.x, &e.y); q.push(mp(0, s)); while(!q.empty()) { pip top = q.front(); q.pop(); if (top.y == e) { printf("%d\n",top.x); pii bt = top.y; vector v; while(bt != s) { v.push_back(fk[bt.x][bt.y]); bt = flag[bt.x][bt.y]; } reverse(v.begin(), v.end()); bool first = false; for(string xx : v) { if (first) printf(" "); if (!first) first = true; printf("%s",xx.c_str()); } printf("\n"); return 0; } insert(top.y.x, top.y.y, top.y.x - 2, top.y.y - 1, top.x, "UL"); insert(top.y.x, top.y.y, top.y.x - 2, top.y.y + 1, top.x, "UR"); insert(top.y.x, top.y.y, top.y.x, top.y.y + 2, top.x, "R"); insert(top.y.x, top.y.y, top.y.x + 2, top.y.y + 1, top.x, "LR"); insert(top.y.x, top.y.y, top.y.x + 2, top.y.y - 1, top.x, "LL"); insert(top.y.x, top.y.y, top.y.x, top.y.y - 2, top.x, "L"); } printf("Impossible\n"); return 0; }