#include using namespace std; int x, y, tx, ty; bool isRecheable(int xi, int yi, int xf, int yf){ int yDiff = yf-yi; int xDiff = xf-xi; if (abs(yDiff)%2 != 0 || (abs(xDiff)+(yDiff/2))%2 != 0 ){ return false; } return true; } string getNextStept(){ int yDiff = ty-y; int xDiff = tx-x; string res = ""; if (x==tx && y==ty){return res;} if (yDiff<0){ res+="U"; y-=2; if(xDiff<0){ res+="L"; x-=1; } else{ res+="R"; x+=1; } } else if (yDiff == 0){ if (xDiff < 0){ res += "L"; x-=2; } else{ res += "R"; x+=2; } } else{ res+="L"; y+=2; if(xDiff<0){ x-=1; res+="L"; } else{ x+=1; res+="R"; } } return res; } vector getPath(){ vector arr; string res = "1"; while (res.compare("") != 0 ){ res = getNextStept(); arr.push_back(res); } return arr; } void printShortestPath(int n, int i_start, int j_start, int i_end, int j_end) { if (!isRecheable(j_start, i_start , j_end, i_end)){ cout << "Impossible" << endl; return; } x = j_start; y = i_start; tx = j_end; ty = i_end; vector res = getPath(); cout << res.size()-1 << endl; for (int i = 0; i> 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; }