#include<stdio.h>///////AOJ0037
                            int
                            w[5
       ][5],i,j;char(b)[    128
       ],*           p;F    (//
       int           v){    for
       (i=    scanf("%s"    ,b)
       -1,    p=b    ;*p    ;++
       p){    w[p    -b+    1-v
       ][j    +v]|=((w[p    -b]
       [j]                  |=(
       p[0                  ]==
       49)<<3-v)&8>>v)>>2;}j+=v

     ;}
    main
  (){  for
 (;F     (0)
,j-       4;F
(1));for(p=b,
j=(       *b=
3)^       3;i        +=-66+"BAB\
C"[       *b]      ,j+=       "?\
@A"       "@"      [*b        ]-(
                   1<<        6),*
                   ++p        =(*
                   b)[        "U"
                   "L"        "D"
                   "R"        ],i
                    +j;)for((++*
  b)&=~4;!((1<<*
         b)&
         w[i
         ][j
]);      (*b
+=3      )&=
~4)     ;re\
turn   !puts
  (b+1);}

