#include #include #include #include #include using namespace std; int dx[6] = {-2, -2, 0, 2, 2, 0}; int dy[6] = {-1, 1, 2, 1, -1, -2}; int inf = 1e9; int get(int x, int y, int xx, int yy) { if (abs(x - xx) % 2 == 1) return inf; int up_moves = abs(x - xx) / 2; if ((abs(y - yy) + up_moves) % 2 == 1) return inf; return up_moves + max(0, (abs(y - yy) - up_moves) / 2); } int main() { int n; cin >> n; int x, y, xx, yy; cin >> x >> y >> xx >> yy; vector t; t.push_back("UL"); t.push_back("UR"); t.push_back("R"); t.push_back("LR"); t.push_back("LL"); t.push_back("L"); if (abs(x - xx) % 2 == 1) { cout << "Impossible"; return 0; } int up_moves = abs(x - xx) / 2; if ((abs(y - yy) + up_moves) % 2 == 1) { cout << "Impossible"; return 0; } int moves = get(x, y, xx, yy); cout << moves << endl; while (x != xx || y != yy) { for (int i = 0; i < 6; ++i) { int new_x = x + dx[i]; int new_y = y + dy[i]; if (new_x < 0 || new_x >= n || new_y < 0 || new_y >= n) continue; if (get(new_x, new_y, xx, yy) + 1 == moves) { x = new_x; y = new_y; --moves; cout << t[i] << " "; break; } } } system("pause"); return 0; }