#include using namespace std; const int dy[6] = {-1, 1, 2, 1, -1, -2}; const int dx[6] = {-2, -2, 0, 2, 2, 0}; const string name[6] = {"UL", "UR", "R", "LR", "LL", "L"}; const int M = 201; const int BIG = 1e9 + 239; int dist[M][M], pr[M][M]; bool check(int n, int x, int y) { return (0 <= x && x < n && 0 <= y && y < n); } void print(int x, int y, int x1, int y1) { if (x == x1 && y == y1) return; print(x - dx[pr[x][y]], y - dy[pr[x][y]], x1, y1); cout << name[pr[x][y]] << " "; } void printShortestPath(int n, int x1, int y1, int x2, int y2) { for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) dist[i][j] = BIG; queue > q; q.push(make_pair(x1, y1)); dist[x1][y1] = 0; while (!q.empty()) { pair t = q.front(); q.pop(); int x = t.first; int y = t.second; for (int i = 0; i < 6; i++) if (check(n, x + dx[i], y + dy[i])) { int gx = x + dx[i]; int gy = y + dy[i]; if (dist[gx][gy] > dist[x][y] + 1) { dist[gx][gy] = dist[x][y] + 1; pr[gx][gy] = i; q.push(make_pair(gx, gy)); } } } if (dist[x2][y2] == BIG) { cout << "Impossible"; return; } cout << dist[x2][y2] << "\n"; print(x2, y2, x1, y1); } 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; }