#include <bits/stdc++.h>
using namespace std;
const int N = 1e2 + 1;
char a[N][N];
vector<vector<char>> ans;
vector<char> v;
bool val(int i, int j) {
return i >= 1 && j >= 1 && i <= 4 && j <= 4 && a[i][j] != '#';
}
void solve(int i, int j) {
if (i == 4 && j == 4) {
ans.push_back(v);
return;
}
// Try moving right
if (val(i, j + 1)) {
v.push_back('R'); // Move right
solve(i, j + 1); // Recur
v.pop_back(); // Backtrack
}
// Try moving down
if (val(i + 1, j)) {
v.push_back('D'); // Move down
solve(i + 1, j); // Recur
v.pop_back(); // Backtrack
}
}
int main() {
for (int i = 1; i <= 4; i++) {
for (int j = 1; j <= 4; j++)
cin >> a[i][j];
}
solve(1, 1);
for (auto &x : ans) {
for (auto &i : x)
cout << i << ' ';
cout << '\n';
}
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7Cgpjb25zdCBpbnQgTiA9IDFlMiArIDE7CmNoYXIgYVtOXVtOXTsKdmVjdG9yPHZlY3RvcjxjaGFyPj4gYW5zOwp2ZWN0b3I8Y2hhcj4gdjsKCmJvb2wgdmFsKGludCBpLCBpbnQgaikgewogICAgcmV0dXJuIGkgPj0gMSAmJiBqID49IDEgJiYgaSA8PSA0ICYmIGogPD0gNCAmJiBhW2ldW2pdICE9ICcjJzsKfQoKdm9pZCBzb2x2ZShpbnQgaSwgaW50IGopIHsKICAgIGlmIChpID09IDQgJiYgaiA9PSA0KSB7CiAgICAgICAgYW5zLnB1c2hfYmFjayh2KTsKICAgICAgICByZXR1cm47CiAgICB9CgogICAgLy8gVHJ5IG1vdmluZyByaWdodAogICAgaWYgKHZhbChpLCBqICsgMSkpIHsKICAgICAgICB2LnB1c2hfYmFjaygnUicpOyAgLy8gTW92ZSByaWdodAogICAgICAgIHNvbHZlKGksIGogKyAxKTsgICAvLyBSZWN1cgogICAgICAgIHYucG9wX2JhY2soKTsgICAgICAvLyBCYWNrdHJhY2sKICAgIH0KCiAgICAvLyBUcnkgbW92aW5nIGRvd24KICAgICBpZiAodmFsKGkgKyAxLCBqKSkgewogICAgICAgIHYucHVzaF9iYWNrKCdEJyk7ICAvLyBNb3ZlIGRvd24KICAgICAgICBzb2x2ZShpICsgMSwgaik7ICAgLy8gUmVjdXIKICAgICAgICB2LnBvcF9iYWNrKCk7ICAgICAgLy8gQmFja3RyYWNrCiAgICB9Cn0KCmludCBtYWluKCkgewogICAgZm9yIChpbnQgaSA9IDE7IGkgPD0gNDsgaSsrKSB7CiAgICAgICAgZm9yIChpbnQgaiA9IDE7IGogPD0gNDsgaisrKQogICAgICAgICAgICBjaW4gPj4gYVtpXVtqXTsKICAgIH0KICAgIHNvbHZlKDEsIDEpOwogICAgZm9yIChhdXRvICZ4IDogYW5zKSB7CiAgICAgICAgZm9yIChhdXRvICZpIDogeCkKICAgICAgICAgICAgY291dCA8PCBpIDw8ICcgJzsKICAgICAgICBjb3V0IDw8ICdcbic7CiAgICB9CiAgICByZXR1cm4gMDsKfQo=