#include using namespace std; void printShortestPath(int n, int i_start, int j_start, int i_end, int j_end) { // Print the distance along with the sequence of moves. int dist=0; vector mov; if((i_end-i_start)%2!=0&&(j_end-j_start)%2==0) { cout<<"Impossible"; return; } int i=i_end-i_start; int j=j_end-j_start; while(i!=0) { if(i>=0&&j>=0) { mov.push_back("LR"); i_start=i_start+2; j_start++; } else if(i>=0&&j<=0) { mov.push_back("LL"); i_start=i_start+2; j_start--; } else if(i<=0&&j>=0) { mov.push_back("UR"); i_start=i_start-2; j_start++; } else if(i<=0&&j<=0) { mov.push_back("UL"); i_start=i_start-2; j_start--; } dist++; i=i_end-i_start; j=j_end-j_start; } j=j_end-j_start; while(j!=0) { if(j>0) { mov.push_back("R"); j_start=j_start+2; } else if(j<0) { mov.push_back("L"); j_start=j_start-2; } dist++; j=j_end-j_start; } cout<::const_iterator i = mov.begin(); i != mov.end(); ++i) { cout<<*i<<" "; } } 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; }