#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; const int SIZE = 1 << 10; int pointer = SIZE; char buffer[SIZE]; char Advance() { if (pointer == SIZE) { fread(buffer, 1, SIZE, stdin); pointer = 0; } return buffer[pointer++]; } int Read() { int answer = 0; char ch = Advance(); while (!isdigit(ch)) ch = Advance(); while (isdigit(ch)) { answer = answer * 10 + ch - '0'; ch = Advance(); } return answer; } const int MAXN = 200; int line[6] = {-2, -2, 0, +2, +2, 0}; int column[6] = {-1, +1, +2, +1, -1, -2}; string s[6] = {"UL", "UR", "R", "LR", "LL", "L"}; int best[1 + MAXN][1 + MAXN], dad[1 + MAXN][1 + MAXN]; queue > Queue; vector answer; int main() { //freopen("tema.in", "r", stdin); //freopen("tema.out", "w", stdout); int n, ls, cs, lf, cf; cin >> n >> ls >> cs >> lf >> cf; for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) best[i][j] = n * n * n; best[ls][cs] = 0; Queue.push(make_pair(ls, cs)); while (!Queue.empty()) { int l = Queue.front().first, c = Queue.front().second; Queue.pop(); for (int i = 0; i < 6; i++) { int l0 = l + line[i], c0 = c + column[i]; if (l0 >= 0 && c0 >= 0 && l0 < n && c0 < n && best[l][c] + 1 < best[l0][c0]) { best[l0][c0] = best[l][c] + 1; dad[l0][c0] = i; Queue.push(make_pair(l0, c0)); } } } if (best[lf][cf] == n * n * n) { cout << "Impossible\n"; return 0; } int l = lf, c = cf; for (int i = 1; i <= best[lf][cf]; i++) { answer.push_back(s[dad[l][c]]); int l0 = l - line[dad[l][c]], c0 = c - column[dad[l][c]]; l = l0; c = c0; } reverse(answer.begin(), answer.end()); cout << answer.size() << "\n"; for (auto &it : answer) cout << it << " "; return 0; }