#include #include #include using namespace std; int xd[6] = {-2,-2,0,2,2,0}; int yd[6] = {-1,1,2,1,-1,-2}; int main() { int n,i,j,k,x,y; cin>>n; int is,js,ie,je; cin>>is>>js>>ie>>je; is++; js++; ie++; je++; pair vec[n+1][n+1]; for(i = 1;i<=n;i++) { for(j = 1;j<=n;j++) { vec[i][j].first = 1000000007; } } queue > q; vec[is][js].first = 0; q.push(make_pair(is,js)); bool found = false; while(!q.empty()) { pair p = q.front(); q.pop(); x = p.first; y = p.second; for(i = 0;i<=5;i++) { if(x+xd[i]>=1&&x+xd[i]<=n&&y+yd[i]>=1&&y+yd[i]<=n) { if(vec[x+xd[i]][y+yd[i]].first>vec[x][y].first+1) { vec[x+xd[i]][y+yd[i]].first = vec[x][y].first+1; vec[x+xd[i]][y+yd[i]].second = i+1; if(x+xd[i] == ie&&y+yd[i] == je) { found = true; break; } q.push(make_pair(x+xd[i],y+yd[i])); } } } if(found == true) { break; } } if(vec[ie][je].first < 1000000007) { cout< ans; string str[6] = {"UL","UR","R","LR","LL","L"}; while(x!=is||y!=js) { i = vec[x][y].second; ans.push_back(str[i-1]); x = x-xd[i-1]; y = y-yd[i-1]; } int ln = ans.size(); for(i = ln-1;i>=0;i--) { cout<