#include using namespace std; typedef long long ll; typedef vector vi; typedef vector vii; typedef vector > vvi; typedef vector > vvii; typedef pair pi; typedef pair pii; typedef vector > vpi; typedef vector > vpii; #define boost std::ios::sync_with_stdio(false);cin.tie(0);cout.tie(0) #define FOR(i,a,b) for(i= (a) ; i<(b); ++i) #define pb push_back #define mp make_pair #define all(x) (x).begin() , (x).end() #define out(x) cout<>n; ll x0,y0,x1,y1,x,y; cin>>x0>>y0>>x1>>y1; FOR(i,0,n+1) FOR(j,0,n+1) vis[i][j]=0; bool ok=0; queue q; q.push(mp(x0,y0)); vis[x0][y0]=1; dist[x0][y0]=0; par[x0][y0]=mp(x0,y0); // UL, UR, R, LR, LL, L vector > cnt; cnt.push_back(mp("UL",mp(-2,-1))); cnt.push_back(mp("UR",mp(-2,1))); cnt.push_back(mp("R",mp(0,2))); cnt.push_back(mp("LR",mp(2,1))); cnt.push_back(mp("LL",mp(2,-1))); cnt.push_back(mp("L",mp(0,-2))); while(!q.empty()) { pii tmp = q.front(); q.pop(); if(tmp.F == x1 && tmp.S == y1){ ok=1; break; } for(auto it=cnt.begin() ; it!=cnt.end() ; it++){ pii lol = it->S; x=tmp.F + lol.F; y=tmp.S + lol.S; if(x>=0 && x=0 && yF; // printf("%s\n", p[x][y].c_str()); par[x][y]=mp(tmp.F,tmp.S); // printf("parent of %lld,%lld = %lld,%lld\n", x,y,tmp.F,tmp.S); } } } } if(!ok){ cout<<"Impossible"; return 0; } printf("%lld\n",dist[x1][y1]); vector ans; x=x1; y=y1; while(!(x == x0 && y == y0)){ // printf("x = %lld y = %lld \n", x,y); ans.push_back(p[x][y]); ll xx=par[x][y].F; ll yy=par[x][y].S; x=xx; y=yy; } reverse(ans.begin(), ans.end()); FOR(i,0,ans.size()) printf("%s ", ans[i].c_str()); return 0; }