#include <cstdio>
#include <dispatch/dispatch.h>
#define W (1920)
#define H (1080)
char board[H][W];
const char * actions = "UULLLDULDRRDDLDULDURLDDRUDLUDRUDLDRRRDLDUDDDLLDURLLUURUDLLUDDDULRRDRLULLLDDRDLUDRRRRUDLRDURLLDDDLLRULURDLLLLDLRRUDLRRLULUUUDULULLLRLLLUDLRDLDLUUUDRUULURURDLLRLDDDDDURDDULURUDDDULLLDRDLULURLUURLRUDLLUULUDLLDUUURLLDLDUURRRUURRRUDLUDURLLLLDRULLLRULRURLUDDLDUL";
void do_action(char action, int den = 1, int task = 0) {
switch (action) {
case 'U':
{
int count = W/den;
int sx = count*task;
for (int x = sx; x < sx+count; ++x) {
int dst_y = 0;
for (int y = 0; y < H; ++y) {
if (board[y][x] != '.') {
board[dst_y++][x] = board[y][x];
}
}
for (; dst_y < H; ++dst_y) {
board[dst_y][x] = '.';
}
}
break;
}
case 'D':
{
int count = W/den;
int sx = count*task;
for (int x = sx; x < sx+count; ++x) {
int dst_y = H-1;
for (int y = H-1; y >= 0; --y) {
if (board[y][x] != '.') {
board[dst_y--][x] = board[y][x];
}
}
for (; dst_y >= 0; --dst_y) {
board[dst_y][x] = '.';
}
}
break;
}
case 'L':
{
int count = H/den;
int sy = count*task;
for (int y = sy; y < sy+count; ++y) {
int dst_x = 0;
for (int x = 0; x < W; ++x) {
if (board[y][x] != '.') {
board[y][dst_x++] = board[y][x];
}
}
for (; dst_x < W; ++dst_x) {
board[y][dst_x] = '.';
}
}
break;
}
case 'R':
{
int count = H/den;
int sy = count*task;
for (int y = sy; y < sy+count; ++y) {
int dst_x = W-1;
for (int x = W-1; x >= 0; --x) {
if (board[y][x] != '.') {
board[y][dst_x--] = board[y][x];
}
}
for (; dst_x >= 0; --dst_x) {
board[y][dst_x] = '.';
}
}
break;
}
}
}
int main(int argc, const char* argv[]) {
const char *ac = actions;
#if 1
/* reduce qctions */
char opt[512];
char attr[256] = {0};
attr['U'] = attr['D'] = 1;
attr['L'] = attr['R'] = 2;
while (1) {
char last[3] = {0};
int dst = 0, count = 0;
for (int i = 0; ac[i]; ++i) {
count++;
int a = attr[ac[i]];
if (ac[i+1] == 0 || a != attr[ac[i+1]]) {
if (last[a] != ac[i]) {
opt[dst++] = ac[i];
last[a] = ac[i];
}
}
}
opt[dst] = 0;
ac = opt;
if (dst == count)
break;
}
#else
ac = actions;
#endif
/* read initial board */
fread(board, W * H, 1, stdin);
#if 1
/* doit */
const int num = 8;
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
dispatch_group_t group = dispatch_group_create();
for (int i = 0; ac[i]; ++i) {
for (int j = 0; j < num; j++) {
dispatch_group_async(group, queue, ^{
do_action(ac[i], num, j);
});
}
dispatch_group_wait(group, DISPATCH_TIME_FOREVER);
}
dispatch_release(group);
#else
/* doit */
for (int i = 0; ac[i]; ++i) {
do_action(ac[i]);
}
#endif
/* write result */
fwrite(board, W * H, 1, stdout);
}