#include using namespace std; #define rep(i, x, y) for(ll i = (x); i <= (y); ++i) #define bug(a) cout << #a << " = " << a << endl; #define fbug(a, x, y) { cout << #a << ": "; rep(i, x, y) cout << a[i] << ' '; cout << endl; } #define pb push_back //#define mp make_pair #define endd "\n" #define fast ios::sync_with_stdio(false);cin.tie(0);cout.tie(0) #define input freopen("inp.txt","r",stdin) #define output freopen("out1.txt","w",stdout) #define loop(i,n) for(ll i=0;i=0;i--) #define ll long long #define Z size() #define pii pair #define setp(x) fixed<=0 && x=0 && y>n>>is>>js>>ie>>je; map >save; queueq; q.push(mp(is,js)); save[is][js]=n*is+js; bool ck=0; vis[is][js]=true; int steps=0; while(!q.empty()){ pii tp=q.front(); q.pop(); int x,y; x=tp.ff-2; y=tp.ss-1; if(isval(x,y)){ q.push(mp(x,y)); save[x][y]=n*tp.ff+tp.ss; vis[x][y]=true; if(x==ie && y==je){ ck=1; break;} } x=tp.ff-2; y=tp.ss+1; if(isval(x,y)){ q.push(mp(x,y)); save[x][y]=n*tp.ff+tp.ss; vis[x][y]=true; if(x==ie && y==je){ ck=1; break;} } x=tp.ff; y=tp.ss+2; if(isval(x,y)){ q.push(mp(x,y)); save[x][y]=n*tp.ff+tp.ss; vis[x][y]=true; if(x==ie && y==je){ ck=1; break;} } x=tp.ff+2; y=tp.ss+1; if(isval(x,y)){ q.push(mp(x,y)); save[x][y]=n*tp.ff+tp.ss; vis[x][y]=true; if(x==ie && y==je){ ck=1; break;} } x=tp.ff+2; y=tp.ss-1; if(isval(x,y)){ q.push(mp(x,y)); save[x][y]=n*tp.ff+tp.ss; vis[x][y]=true; if(x==ie && y==je){ ck=1; break;} } x=tp.ff; y=tp.ss-2; if(isval(x,y)){ q.push(mp(x,y)); save[x][y]=n*tp.ff+tp.ss; vis[x][y]=true; if(x==ie && y==je){ ck=1; break;} } } if(ck){ string ans=""; int x=ie,y=je; //bug(save[x][y]); while(x!=is || y!=js){ steps++; int a,b; int sum=save[x][y]; a=sum/n; b=sum%n; //bug(sum); //bug(a); //bug(b); if(a==x-2 && b==y-1){ ans+=" RL"; } if(a==x-2 && b==y+1){ ans+=" LL"; } if(a==x && b==y+2){ ans+=" L"; } if(a==x+2 && b==y+1){ ans+=" LU"; } if(a==x+2 && b==y-1){ ans+=" RU"; } if(a==x && b==y-2){ ans+=" R"; } // cout<