#include using namespace std; bool ok = false, f[1005][1005]; int F[1005][1005]; pair p[1005][1005]; string str[] = {"UL", "UR", "R", "LR", "LL", "L"}; int a[][2] = {{-1, -2}, {1, -2}, {2, 0}, {1, 2}, {-1, 2}, {-2, 0}}; void print(int x, int y, int t) { vector re; cout << t << endl; pair tmp; while (p[x][y] != make_pair(-1, -1)) { re.push_back(str[F[x][y]]); tmp = p[x][y]; x = tmp.first; y = tmp.second; } for (int i = re.size() - 1; i >= 0; --i) { cout << re[i] << " "; } } void sol(string s[], int x, int y, int xEnd, int yEnd, int n) { queue > > q; int curt, curx, cury, tmpx, tmpy; q.push(make_pair(0, make_pair(x, y))); p[x][y] = make_pair(-1, -1); f[x][y] = true; while (q.size()) { pair > tmp = q.front(); q.pop(); curt = tmp.first; curx = tmp.second.first; cury = tmp.second.second; //cout << curt << " " << curx << " " << cury << " " << str[F[curx][cury]] << endl; if ((curx == xEnd) && (cury == yEnd)) { print(xEnd, yEnd, curt); ok = true; } if (ok) { break; } for (int i = 0; i < 6; ++i) { tmpx = curx + a[i][0]; tmpy = cury + a[i][1]; if ((!f[tmpx][tmpy]) && (tmpx >= 0) && (tmpx < n) && (tmpy >= 0) && (tmpy < n)) { q.push(make_pair(curt + 1, make_pair(tmpx, tmpy))); F[tmpx][tmpy] = i; p[tmpx][tmpy] = make_pair(curx, cury); f[tmpx][tmpy] = true; } } } } int main() { string s[1000005]; int n, x, y, xEnd, yEnd; cin >> n >> y >> x >> yEnd >> xEnd; ok = false; memset(f, false, sizeof(f)); sol(s, x, y, xEnd, yEnd, n); if (!ok) { cout << "Impossible"; } }