#include using namespace std; int ar[200][200]; 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. vector path; int addX[] = {-2, -2, 0, 2, 2, 0}; int addY[] = {-1, 1, 2, 1, -1, -2}; string mov[] = {"UL", "UR", "R","LR", "LL","L"}; queue< pair , vector > > points; points.push(make_pair(make_pair(i_start, j_start), path)); ar[i_start][j_start] = 1; if((i_start - i_end) % 2 == 0) while(points.size() ){ pair , vector > cPoint = points.front(); points.pop(); int i = cPoint.first.first; int j = cPoint.first.second; vector cPath = cPoint.second; if(i == i_end && j == j_end){ path = cPath; break; } else{ for(int in = 0; in < 6 ;in++){ int newI = i + addX[in]; int newJ = j + addY[in]; vector cPath2 = cPath; if(newI >= 0 && newI < n && newJ >= 0 && newJ < n && (ar[newI][newJ] == 0) ){ cPath2.push_back(mov[in]); ar[newI][newJ] = 1; points.push(make_pair(make_pair(newI, newJ), cPath2)); } } } } if(path.size() == 0){ cout << "Impossible"; } else{ cout << path.size() <<"\n"; int i; for(i = 0;i < path.size() - 1; i++){ cout << path[i] << " "; } cout << path[i]; } } 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; }