#include using namespace std; const int N = 202; int n, staY, staX, desX, desY; typedef pair pii; int dx[6] = {-2, -2, 0, 2, 2, 0}, dy[6] = {-1, 1, 2, 1, -1, -2}; string dir[6] = {"UL", "UR", "R", "LR", "LL", "L"}; pii trace[N][N]; bool inrange(int x, int y) { return x > 0 && x <= n && y > 0 && y <= n; } #define X first #define Y second #define mp make_pair bool was[N][N]; int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ cin >> n >> staX >> staY >> desX >> desY; staX++; staY++; desX++; desY++; queue qu; qu.push(mp(staX, staY)); was[staX][staY] = true; while (qu.size()) { //cout << qu.size() << "\n"; int x = qu.front().X, y = qu.front().Y; qu.pop(); if (x == desX && y == desY) break; for (int i = 0; i < 6; i++) { int xx = x + dx[i], yy = y + dy[i]; if (inrange(xx, yy) && !was[xx][yy]) { was[xx][yy] = true; trace[xx][yy] = mp(x, y); qu.push(mp(xx, yy)); } } } if (!was[desX][desY]) { cout << "Impossible"; return 0; } vector tr; while (desX != staX || desY != staY) { int x = trace[desX][desY].X, y = trace[desX][desY].Y; for (int i = 0; i < 6; i++) if (x + dx[i] == desX && y + dy[i] == desY) tr.push_back(dir[i]); desX = x; desY = y; } cout << tr.size() << "\n"; reverse(tr.begin(), tr.end()); for (auto x: tr) cout << x << " "; return 0; }