/*input 7 0 3 4 3 */ /* _==/ i i \==_ /XX/ |\___/| \XX\ /XXXX\ |XXXXX| /XXXX\ |XXXXXX\_ _XXXXXXX_ _/XXXXXX| XXXXXXXXXXXxxxxxxxXXXXXXXXXXXxxxxxxxXXXXXXXXXXX |XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX| XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX |XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX| XXXXXX/^^^^"\XXXXXXXXXXXXXXXXXXXXX/^^^^^\XXXXXX |XXX| \XXX/^^\XXXXX/^^\XXX/ |XXX| \XX\ \X/ \XXX/ \X/ /XX/ "\ " \X/ " /" */ #include using namespace std; #define ll long long //loops #define f(i,s,n) for(ll i=(ll)s;i<(ll)n;i++) #define rf(i,n,s) for(ll i=(ll)(n-1);i>=(ll)s;i--) //reset #define ms0(X) memset((X), 0, sizeof((X))) #define ms1(X) memset((X), -1, sizeof((X))) //IO #define bio ios_base::sync_with_stdio;cin.tie(NULL) //STL #define pb push_back #define pii pair #define vll vector #define vpii vector #define mll map #define mpii map #define msll map #define sortv(v) sort(v.begin(),v.end()) #define F first #define S second //standard values #define mod (ll)(1e9+7) #define INF (ll)1e16 #define MAXN (ll)(1e5+5) //comparator bool cmp(pair a,pair b){ if(a.F.F & p) { return n < p.F.F; } string moves[] = {"UL", "UR", "R", "LR", "LL", "L"}; pii cord[] = {{-2, -1}, {-2, 1}, {0, 2}, {2, 1}, {2, -1}, {0, -2}}; //bool vis[205][205]; string mo[205][205]; ll dis[205][205]; queue > >q; ll n; bool isvalid(int x, int y) { return x>=0 && x<=n-1 && y>=0 && y<=n-1; } int main() { bio; cin>>n; ll sx, sy, ex, ey; cin>>sx>>sy>>ex>>ey; ll ans = 0; f(i,0,n){ f(j,0,n){ dis[i][j] = INF; } } dis[sx][sy] = 0; string temp = ""; q.push({{sx, sy}, {0, ""}}); while(!q.empty()){ pair > p = q.front(); q.pop(); ll x = p.F.F; ll y = p.F.S; ll dist = p.S.F; string dir = p.S.S; f(i,0,6){ ll nx = x + cord[i].F; ll ny = y + cord[i].S; if(isvalid(nx, ny) && dis[nx][ny] > dist + 1){ dis[nx][ny] = dist + 1; mo[nx][ny] = moves[i]; if(nx != ex || ny != ey){ q.push({{nx, ny}, {dis[nx][ny], moves[i]}}); } } } } if(dis[ex][ey] != INF){ cout< ans; f(i,0,dis[ex][ey]){ ans.pb(mo[x][y]); if(mo[x][y] == "L"){ x += 0; y += 2; }else if(mo[x][y] == "UL"){ x += 2; y += 1; }else if(mo[x][y] == "UR"){ x += 2; y += -1; }else if(mo[x][y] == "R"){ x += 0; y += -2; }else if(mo[x][y] == "LL"){ x += -2; y += 1; }else if(mo[x][y] == "LR"){ x += -2; y += -1; } } reverse(ans.begin(), ans.end()); for(auto it:ans){ cout<