#include #include #include #include #include using namespace std; int main() { int cx,cy,tx,ty; int t; //int grid[t+1][t+1]; cin >> t; cin >> cx >> cy >> tx >> ty; int count = 0; std::vector v; if(abs(cx-tx)%2 != 0){ cout << "Impossible" << endl; return 0; } else if(abs(cy-ty) == 0 && abs(cx-tx)%4 != 0){ cout << "Impossible" << endl; return 0; } else if(abs(cx-tx)%2 == 0 && (abs(cy-ty)-(abs(cx-tx)/2))%2 != 0){ cout << "Impossible" << endl; return 0; } else{ while(1){ if(cx == tx && cy == ty) break; if(cx > tx && cy >= ty){ if(cx-2 > 0 || cy-1 > 0 || cx-2 < t || cy-1 < t){ cx-=2; cy--; v.push_back(1); ++count; } } else if(cx > tx && cy < ty){ if(cx-2 > 0 || cy+1 > 0 || cx-2 < t || cy+1 < t){ cx-=2; cy++; v.push_back(2); ++count; } } else if(cx < tx && cy >= ty){ if(cx+2 >= 0 || cy-1 >= 0 || cx+2 < t || cy-1 < t){ cx+=2; cy--; v.push_back(5); ++count; } } else if(cx < tx && cy < ty){ if(cx+2 >= 0 || cy+1 >= 0 || cx+2 < t || cy+1 < t){ cx+=2; cy++; v.push_back(4); ++count; } } else if(cx == tx && cy < ty){ if(cx >= 0 || cy+2 >= 0 || cx < t || cy < t){ cy+=2; v.push_back(3); ++count; } } else if(cx == tx && cy > ty){ if(cx >= 0 || cy-2 >= 0 || cx < t || cy < t){ cy-=2; v.push_back(6); ++count; } } else{ cout << "Impossible" << endl; return 0; } } } int n = v.size(); sort(v.begin(),v.end()); cout << count << endl; for(int i = 0; i < n; ++i){ if(v[i] == 1) cout << "UL "; if(v[i] == 2) cout << "UR "; if(v[i] == 3) cout << "R "; if(v[i] == 4) cout << "LR "; if(v[i] == 5) cout << "LL "; if(v[i] == 6) cout << "L "; } cout << endl; }