#include using namespace std; int dx[] = {-2, -2, 0, 2, 2, 0}; int dy[] = {-1, 1, 2, 1, -1, -2}; class node{ public: int x; int y; string path; node(int i, int j, string path){ this->x = i; this->y = j; this->path = path; } }; void printShortestPath(int n, int i_start, int j_start, int i_end, int j_end) { // Print the distance along with the sequence of moves. queue pos_q; unordered_map visited; pos_q.push(node(i_start, j_start, "")); int step = 0; while(!pos_q.empty()){ int size = pos_q.size(); for(int i = 0 ; i < size ; i++){ auto tmp = pos_q.front(); if(visited[tmp.x * n + tmp.y] == true){ pos_q.pop(); continue; } string curPath = tmp.path; pos_q.pop(); if(tmp.x == i_end && tmp.y == j_end){ cout< 0) curPath.pop_back(); cout<= 0 && new_x < n && new_y >= 0 && new_y < n){ if(visited[new_x * n + new_y] == false){ string action; if(j == 0) action = "UL "; if(j == 1) action = "UR "; if(j == 2) action = "R "; if(j == 3) action = "LR "; if(j == 4) action = "LL "; if(j == 5) action = "L "; string path = curPath + action; node t = node(new_x, new_y, path); pos_q.push(t); } } } } step++; } cout<<"Impossible"; } 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; }