#include using namespace std; void printShortestPath(int n, int i_st, int j_st, int i_en, int j_en) { map ans; if(abs(i_st - i_en) % 2) { cout << "Impossible"; return; } int even = abs(i_st - i_en)/2; if(even % 2 && abs(j_st - j_en) % 2 == 0) { cout << "Impossible"; return; } else if(even % 2 == 0 && abs(j_st - j_en) % 2) { cout << "Impossible"; return; } //vector < string > ans; while(abs(i_st - i_en)) { if(i_st > i_en) { if(j_en < j_st) { j_st--; i_st-=2; ans["UL"]++; } else if(j_en > j_st) { j_st++; i_st-=2; ans["UR"]++; } else { if(j_st-1 >= 0) { i_st-=2; j_st--; ans["UL"]++; } else { i_st-=2; j_st++; ans["UR"]++; } } } else { if(j_en < j_st) { j_st--; i_st+=2; ans["LL"]++; } else if(j_en > j_st) { j_st++; i_st+=2; ans["LR"]++; } else { if(j_st + 1 <= n-1) { i_st+=2; j_st++; ans["LR"]++; } else { i_st += 2; j_st--; ans["LL"]++; } } //cout << "New : " << i_st << ' ' << j_st << endl; } } while(abs(j_st - j_en)) { if(j_st > j_en) { j_st-=2; ans["L"]++; } else { j_st+=2; ans["R"]++; } } long sum = 0; for(auto i = ans.begin(); i != ans.end(); i++) sum += i->second; cout << sum << endl; for(auto i = 0; i < ans[("UL")]; i++) cout << "UL "; for(auto i = 0; i < ans[("UR")]; i++) cout << "UR "; for(auto i = 0; i < ans[("R")]; i++) cout << "R "; for(auto i = 0; i < ans[("LR")]; i++) cout << "LR "; for(auto i = 0; i < ans[("LL")]; i++) cout << "LL "; for(auto i = 0; i < ans[("L")]; i++) cout << "L "; //for(auto i : ans) //cout << i << ' '; cout << '\n'; } 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; }