#include #define mp make_pair #define FOR(i,n) for(int i=0;i=0; i--) #define lli long long int #define ulli unsigned long long int #define dout if(debug)cout<<" " using namespace std; int debug = 0; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; int sx, sy, ex, ey; cin >> sx >> sy >> ex >> ey; string arr[6]; arr[0] = "UL"; arr[1] = "UR"; arr[2] = "R"; arr[3] = "LR"; arr[4] = "LL"; arr[5] = "L"; vector steps; int flag = 0; while(sx != ex || sy != ey){ int diffx = sx - ex; int diffy = sy - ey; if(diffx > 0){ if(diffx%2 == 0){ if(diffy >= 0){ if(sy >= 1){ steps.push_back(0); sx-=2; sy-=1; } else if(sy <= n-2){ steps.push_back(1); sx-=2; sy+=1; } else{ cout << "Impossible" << endl; flag = 1; break; } } else{ if(sy <= n-2){ steps.push_back(1); sx-=2; sy+=1; } else if(sy >= 1){ steps.push_back(0); sx-=2; sy-=1; } else{ cout << "Impossible" << endl; flag = 1; break; } } } else{ cout << "Impossible"; flag = 1; break; } } else if(diffx == 0){ dout << "in diffx == 0" << endl; if(diffy%2==0){ if(diffy > 0){ int jumps = diffy/2; jumps = abs(jumps); dout << "jumps" << jumps << endl; for(int j = 0; j < jumps; j++){ steps.push_back(5); sy-=2; } } else if(diffy < 0){ int jumps = diffy/2; jumps = abs(jumps); dout << "jumps" << jumps << endl; for(int j = 0; j < jumps; j++){ steps.push_back(2); sy+=2; } } } else{ cout << "Impossible"; flag = 1; break; } } else{ if(diffx%2 == 0){ if(diffy < 0){ int jumpdown = diffx/2; dout << "jumpdown" << jumpdown << endl; int jumpright = abs(diffy) - abs(jumpdown); dout << "jumpright" << jumpright << endl; if(jumpright > 0){ if(jumpright % 2 == 0){ for(int j = 0; j < (jumpright/2); j++){ steps.push_back(2); sy+=2; } } else{ cout << "Impossible"; flag = 1; break; } } if(sy <= n-2){ steps.push_back(3); sx+=2; sy+=1; } else if(sy >= 1){ steps.push_back(4); sx+=2; sy-=1; } else{ cout << "Impossible" << endl; flag = 1; break; } } else if(diffy == 0){ if(sy <= n-2){ steps.push_back(3); sx+=2; sy+=1; } else if(sy >= 1){ steps.push_back(4); sx+=2; sy-=1; } else{ cout << "Impossible" << endl; flag = 1; break; } } else{ if(sy >= 1){ steps.push_back(4); sx+=2; sy-=1; } else if(sy <= n-2){ steps.push_back(3); sx+=2; sy+=1; } else{ cout << "Impossible" << endl; flag = 1; break; } } } else{ cout << "Impossible"; flag = 1; break; } } } sort(steps.begin(), steps.end()); if(flag == 0){ cout << steps.size() << endl; for(int i = 0; i < steps.size(); i++){ if(steps[i] == 0){ cout << "UL "; } else if(steps[i] == 1){ cout << "UR "; } else if(steps[i] == 2){ cout << "R "; } else if(steps[i] == 3){ cout << "LR "; } else if(steps[i] == 4){ cout << "LL "; } else if(steps[i] == 5){ cout << "L "; } } } return 0; }