#include #include using namespace std; void printShortestPath(int n, int i_start, int j_start, int i_end, int j_end) { int k, l, count = 0; bool start = true; string result = ""; if (((i_end-i_start)/2)*2 == i_end-i_start && (i_end-i_start)/2 < n) { k = (i_end-i_start)/2; if (((j_end+k%2-j_start)/2)*2 == (j_end+k%2-j_start) && (j_end+k%2-j_start)/2 < n) { l = (j_end-j_start); k*=2; while (k!=0 || l!=0) { if (!start) { result += " "; } start = false; if (l < 0 && k == 0) { result += "L"; l+=2; } else if (l > 0 && k == 0) { result += "R"; l-=2; } else if (l <= 0 && k < 0) { result += "UL"; k+=2; l++; } else if (l > 0 && k < 0) { result += "UR"; k+=2; l--; } else if (l < 0 && k > 0) { result += "LL"; k-=2; l++; } else if (l >= 0 && k > 0) { result += "LR"; k-=2; l--; } count++; } cout << count << endl << result << endl; } else cout << "Impossible" << endl; } else cout << "Impossible" << endl; } 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; }