#include using namespace std; int vx[6] = {-2, -2, 0, 2, 2, 0}, vy[6] = {-1, 1, 2, 1, -1, -2}; string s[6] = {"UL", "UR", "R", "LR", "LL", "L"}; int beam = 2; int n, sx, sy, gx, gy; inline bool check(int x, int y) { return (0 <= x && x < n && 0 <= y && y < n); } int main() { cin.tie(0), cout.tie(0); ios::sync_with_stdio(false); cin >> n; cin >> sx >> sy >> gx >> gy; bool used[201][201] = {{false}}; queue > que; // x, y, distance que.push({sx, sy, ""}); used[sx][sy] = true; while (!que.empty()) { tuple t = que.front(); que.pop(); if (gx == get<0>(t) && gy == get<1>(t)) { string seq = get<2>(t); cout << seq.size() << "\n"; for (int i = 0; i < seq.size(); ++i) { cout << s[(unsigned int)(seq[i] - '0')] << (i == seq.size() - 1 ? "\n" : " "); } return 0; } int cnt = 0; for (int i = 0; i < 6; ++i) { int nx = get<0>(t) + vx[i], ny = get<1>(t) + vy[i]; if (!used[nx][ny] && check(nx, ny) && abs(gx - nx) + abs(gy - ny) < abs(gx - get<0>(t)) + abs(gy - get<1>(t))) { used[nx][ny] = true; if (beam > cnt) que.push({nx, ny, get<2>(t) + to_string(i)}); else break; cnt++; } } } cout << "Impossible\n"; return 0; }