#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int C[1001][1001];
int n, m;
int main() {
cin >> n >> m;
int x, y, x0, y0;
for (int i = 0; i < n; ++i) {
for (int j = 0; j < m; ++j) {
char c;
cin >> c;
C[i][j] = 1e9;
if (c == 'A') {
y = i;
x = j;
} else if (c == 'B') {
y0 = i;
x0 = j;
}
}
}
C[y][x] = 1;
queue<tuple<int,int,int>> Q;
Q.push({x,y,1});
while (!Q.empty()) {
auto [x,y,w] = Q.front();
if (x == x0 && y == y0) {
break;
}
++w;
Q.pop();
if (x > 0 && C[y][x-1] == 0) {
C[y][x-1] = w;
Q.push({y,x-1});
}
if (y > 0 && C[y-1][x] == 0) {
C[y-1][x] = w;
Q.push({y-1,x});
}
if (x < m-1 && C[y][x+1] == 0) {
C[y][x+1] = w;
Q.push({y,x+1});
}
if (y < n-1 && C[y+1][x] == 0) {
C[y+1][x] = w;
Q.push({y+1,x});
}
}
int w = C[y0][x0];
string P;
swap(x,x0);
swap(y,y0);
while (x != x0 || y != y0) {
--w;
if (x > 0 && C[y][x-1] == w) {
P += 'R';
--x;
}
if (y > 0 && C[y-1][x] == w) {
P += 'D';
--y;
}
if (x < m-1 && C[y][x+1] == w) {
P += 'L';
++x;
}
if (y < n-1 && C[y+1][x] == w) {
P += 'U';
++y;
}
}
reverse(P.begin(), P.end());
cout << P;
}