#include using namespace std; void printShortestPath(int n, int i_start, int j_start, int i_end, int j_end) { enum dir{UL, UR, R, LR, LL, L}; dir direction; vector path; int steps = 0; while (1) { int h = - i_end + i_start; int w = j_end - j_start; if (h == 0 && w == 0) { break; } else if ((abs(h) <= 1 && abs(w) <= 1) || abs(h) % 2 != 0) { cout << "Impossible"; return; } if (h > 0) { if (w > 0) { path.push_back("UR"); direction = UR; } else if (w <= 0) { int w1 = abs(w); path.push_back("UL"); direction = UL; } } else if (h < 0) { int h1 = abs(h); if (w > 2 || (w == 2 && j_end < n - 1)) { path.push_back("R"); direction = R; } else if (w < 0) { path.push_back("LL"); direction = LL; } else { path.push_back("LR"); direction = LR; } } else { if (w > 0) { path.push_back("R"); direction = R; } else { path.push_back("L"); direction = L; } } steps++; switch (direction) { case UL: i_start -= 2; j_start -= 1; break; case UR: i_start -= 2; j_start += 1; break; case R: j_start += 2; break; case LR: i_start += 2; j_start += 1; break; case LL: i_start += 2; j_start -= 1; break; case L: j_start -= 2; break; } } cout << steps << endl; for (auto val : path) { cout << val << ' '; } } int main() { int n; cin >> n; int i_start; int j_start; int i_end; int j_end; cin >> i_start >> j_start >> i_end >> j_end; printShortestPath(n, i_start, j_start, i_end, j_end); return 0; }