#include using namespace std; int S[210][210]; int N; int xz, yz; int X[] = {-1, 1, 2, 1, -1, -2}; int Y[] = {-2, -2, 0, 2, 2, 0}; string mov[] = {"UL", "UR", "R", "LR", "LL", "L"}; void sp(){ for(int i=0; i> Q; Q.push(make_pair(yz, xz)); while(!Q.empty()){ int x = Q.front().second; int y = Q.front().first; Q.pop(); for(int i=0; i<6; i++){ int yn = y - Y[i]; int xn = x - X[i]; if(yn < 0 || yn >=N || xn < 0 || xn >= N) continue; if(S[yn][xn] > S[y][x] + 1){ S[yn][xn] = S[y][x] + 1; Q.push(make_pair(yn, xn)); } } } } void pSP(int y, int x) { if(S[y][x] < 100){ stack St; cout << S[y][x] << endl; while(0=N || xn < 0 || xn >= N) continue; //cout << "cons " << yn << ", " << xn << endl; if(S[yn][xn] == S[y][x]-1){ cout << mov[i] << " "; //St.push(i); y = yn; x = xn; break; } } } /* cout << St.size() << endl; while(!St.empty()){ cout << mov[St.top()] << " "; St.pop(); } */ cout << endl; } else{ cout << "Impossible" << endl; } } void print_all(){ for(int i=0; i> N; int i_start; int j_start; cin >> i_start >> j_start >> yz >> xz; sp(); //print_all(); pSP(i_start, j_start); return 0; }