#include <bits/stdc++.h>
using namespace std;

int main() {
int x, y;
  cin >> x >> y;
  vector<vector<int>> cyancheck(51, vector<int>(51));
  cyancheck.at(x).at(y) = 1;
  int k = 2;
  vector<vector<int>> cyanmond(51, vector<int>(51));
    for (int i = 0; i < 50; i++) {
    for (int j = 0; j < 50; j++) {
      cin >> cyanmond.at(i).at(j);
      if(!(j == 0)){
      if(cyanmond.at(i).at(j) == cyanmond.at(i).at(j - 1)){
        cyancheck.at(i).at(j) = k;
        cyancheck.at(i).at(j - 1) = k;
        k++;
      }
      }
      if(!(i == 0)){
      if(cyanmond.at(i).at(j) == cyanmond.at(i - 1).at(j)){
        cyancheck.at(i).at(j) = k;
        cyancheck.at(i - 1).at(j) = k;
        k++;
      }
      }
      
    }
  }

  if(x > 25 && y < 25){
    if(!(cyanmond.at(x).at(y) == cyanmond.at(x - 1).at(y)) && !(cyancheck.at(x - 1).at(y) == 1)){
      cout << "U";
      cyancheck.at(x).at(y) = 1;
      cyancheck.at(x - 1).at(y) = 1;
      x = x - 1;}
    if(!(cyanmond.at(x).at(y) == cyanmond.at(x).at(y + 1)) && !(cyancheck.at(x).at(y + 1) == 1)){
      cout << "R";
      cyancheck.at(x).at(y) = 1;
      cyancheck.at(x).at(y + 1) = 1;
      y = y + 1;       
    }
    }
    if(x <= 25 && y < 25){
    if(!(cyanmond.at(x).at(y) == cyanmond.at(x + 1).at(y)) && !(cyancheck.at(x + 1).at(y) == 1)){
      cout << "D";
      cyancheck.at(x).at(y) = 1;
      cyancheck.at(x + 1).at(y) = 1;
      x = x + 1;}
    if(!(cyanmond.at(x).at(y) == cyanmond.at(x).at(y + 1)) && !(cyancheck.at(x).at(y + 1) == 1)){
      cout << "R";
      cyancheck.at(x).at(y) = 1;
      cyancheck.at(x).at(y + 1) = 1;
      y = y + 1; 
    }
    }
  
    if(x > 25 && y >= 25){
    if(!(cyanmond.at(x).at(y) == cyanmond.at(x - 1).at(y)) && !(cyancheck.at(x - 1).at(y) = 1)){
      cout << "U";
      cyancheck.at(x).at(y) = 1;
      cyancheck.at(x - 1).at(y) = 1;
      x = x - 1;}
    if(!(cyanmond.at(x).at(y) == cyanmond.at(x).at(y - 1)) && !(cyancheck.at(x).at(y - 1) == 1)){
      cout << "L";
      cyancheck.at(x).at(y) = 1;
      cyancheck.at(x).at(y + 1) = 1;
      y = y + 1; 
    }
    }
       if(x <= 25 && y >= 25){
    if(!(cyanmond.at(x).at(y) == cyanmond.at(x + 1).at(y)) && !(cyancheck.at(x + 1).at(y) == 1)){
      cout << "D";
      cyancheck.at(x).at(y) = 1;
      cyancheck.at(x + 1).at(y) = 1;
      x = x + 1;}
    if(!(cyanmond.at(x).at(y) == cyanmond.at(x).at(y - 1)) && !(cyancheck.at(x).at(y - 1) == 1)){
      cout << "L";
      cyancheck.at(x).at(y) = 1;
      cyancheck.at(x).at(y - 1) = 1;
      y = y - 1; 
    }
    }
 
}

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define REP(i,n) for(ll i=0;i<(n);i++)
#define ALL(v) v.begin(),v.end()
constexpr ll MOD=1000000007;
constexpr ll INF=2e18;

const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
const int beamwidth = 300;
const double TL=1.9;
double start;

int n=50;
int sx, sy;
VVI t(n,VI(n));
VVI p(n,VI(n));

struct status{
    int x;
    int y;
    int score;
    int eval;
    VI path;
    VI used;
    bool operator<(const status &another) const {return eval < another.eval;};
};

vector<status> search(const status &base){
    vector<status> res;
    REP(i,4){
        int tox=base.x+dx[i];
        int toy=base.y+dy[i];
        if(tox<0||tox>=n||toy<0||toy>=n)
            continue;
        if(base.used[t[tox][toy]])
            continue;
        int anotp=p[tox][toy];
        REP(j,4){
            int toox=tox+dx[j];
            int tooy=toy+dy[j];
            if(toox<0||toox>=n||tooy<0||tooy>=n)
                continue;
            if(t[tox][toy]==t[toox][tooy]){
                anotp=p[toox][tooy];
                break;
            }
        }
        int newscore=base.score+p[tox][toy]+max(0,p[tox][toy]-anotp);
        int dlx=min(tox,49-tox), dly=min(toy,49-toy);
        int neweval=newscore-(3*(dlx+dly)+min(dlx,dly))*100;
        res.push_back((status){tox,toy,newscore,neweval,base.path,base.used});
        res[res.size()-1].used[t[tox][toy]]=1;
        res[res.size()-1].path.push_back(i);
    }
    return res;
}

int main(){
    start=clock();
    cin >> sx >> sy;
    int maxt=0;
    REP(i,n)REP(j,n){
        cin >> t[i][j];
        maxt=max(maxt,t[i][j]);
    }
    REP(i,n)REP(j,n) cin >> p[i][j];
    priority_queue<status> que;
    VI initused(maxt+1,0); initused[t[sx][sy]]=1;
    que.push({sx,sy,p[sx][sy],0,VI(0),initused});
    int maxscore=0; VI ans;
    while(1){
        priority_queue<status> nxtque;
        VVI mxs(n,VI(n,0));
        while(nxtque.size()<beamwidth){
            if(que.empty())
                break;
            if(que.top().score>maxscore){
                maxscore=que.top().score;
                ans=que.top().path;
            }
            vector<status> res=search(que.top());
            for(auto j:res){
                if(mxs[j.x][j.y]<10){
                    mxs[j.x][j.y]++;
                    nxtque.push(j);
                }
            }
            que.pop();
        }
        que=nxtque;
        double tim=(double)(clock()-start)/CLOCKS_PER_SEC/TL;
        if(tim>=1.0||que.empty())
            break;
    }
    string dir="DRUL";
    for(auto i:ans)
        cout << dir[i];
    cout << endl;
    return 0;
}