d=2
map=*$<
o=?R
x,y=1,0
(u,v=1,1
(d+=1
u=x+[0,0,-1,0][d%4]
v=y+[0,1,0,-1][d%4]
)until u>=0&&v>=0&&v<9&&map[v][u]==?1
e=d%4
x+=[1,0,-1,0][e]
y+=[0,2,0,-2][e]
o+="RDLU"[e]
d+=2
)while [x,y]!=[0,0]
puts o