#include using namespace std; struct pos { int x, y; int count; string s; pos() {} pos(int _a, int _b) { x = _a; y = _b; count = 0; } }; void printShortestPath(int N, int i_start, int j_start, int i_end, int j_end) { vector > visited(N, vector (N, false)); queue q; q.push(pos(i_start, j_start)); while(!q.empty()) { pos p = q.front(); q.pop(); // UL, UR, R, LR, LL, L if(p.x == i_end && p.y == j_end) { cout<= 0 && p.y - 1 >= 0 && !visited[p.x - 2][p.y - 1]) { pos r(p.x - 2, p.y - 1); r.count = p.count + 1; r.s = p.s + "UL "; q.push(r); visited[p.x - 2][p.y - 1] = true; } if(p.x - 2 >= 0 && p.y + 1 < N && !visited[p.x - 2][p.y + 1]) { pos r(p.x - 2, p.y + 1); r.count = p.count + 1; r.s = p.s + "UR "; q.push(r); visited[p.x - 2][p.y + 1] = true; } if(p.y + 2 < N && !visited[p.x][p.y + 2]) { pos r(p.x, p.y + 2); r.count = p.count + 1; r.s = p.s + "R "; q.push(r); visited[p.x][p.y + 2] = true; } if(p.x + 2 < N && p.y + 1 < N && !visited[p.x + 2][p.y + 1]) { pos r(p.x + 2, p.y + 1); r.count = p.count + 1; r.s = p.s + "LR "; q.push(r); visited[p.x + 2][p.y + 1] = true; } if(p.x + 2 < N && p.y - 1 >= 0 && !visited[p.x + 2][p.y - 1]) { pos r(p.x + 2, p.y - 1); r.count = p.count + 1; r.s = p.s + "LL "; q.push(r); visited[p.x + 2][p.y - 1] = true; } if(p.y - 2 >= 0 && !visited[p.x][p.y - 2]) { pos r(p.x, p.y - 2); r.count = p.count + 1; r.s = p.s + "L "; q.push(r); visited[p.x][p.y - 2] = true; } } cout<<"Impossible\n"; } 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; }