Go: package main

import (
	"bufio"
	"os"
	"strings"
	"strconv"
	"fmt"
)

var points [5][5][4]bool

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	for i := 0; i < 9; i++ {
		y := i/2
		if i%2 == 0 {
			scanner.Scan()
			info := strings.Split(scanner.Text(), "")
			for k := range info {
				e, _ := strconv.Atoi(info[k])
				if e != 0 {
					points[y][k][1], points[y][k+1][3] = true, true
				}
			}
		} else {
			scanner.Scan()
			info := strings.Split(scanner.Text(), "")
			for k := range info {
				e, _ := strconv.Atoi(info[k])
				if e != 0 {
					points[y][k][2], points[y+1][k][0] = true, true
				}
			}
		}
	}
	x := 1
	y := 0
	dir := 1
	dx := []int{0, 1, 0, -1}
	dy := []int{-1, 0, 1, 0}
	ds := "URDL"
	fmt.Printf("%s", string(ds[dir]))
	for !(x == 0 && y == 0) {
		if points[y][x][(dir+3)%4] {
			dir = (dir+3)%4
		} else if points[y][x][dir] {

		} else if points[y][x][(dir+1)%4] {
			dir = (dir+1)%4
		} else {
			dir = (dir+2)%4
		}
		x += dx[dir]
		y += dy[dir]
		fmt.Printf("%s", string(ds[dir]))
	}
	fmt.Println()
}

Python: def move(position):
    x = position[0]
    y = position[1]
    d = position[2]
    if d == "L":
        p = "DLUR"
    elif d == "R":
        p = "URDL"
    elif d == "U":
        p = "LURD"
    else:
        p = "RDLU"
    for i in range(4):
        if p[i] in grid[y][x]:
            d = p[i]
            if d == "L":
                print("L",end="")
                x -= 1
                break
            elif d == "R":
                print("R",end="")
                x += 1
                break
            elif d == "U":
                print("U",end="")
                y -= 1
                break
            else:
                print("D",end="")
                y += 1
                break
    return [x, y, d]

pos = [1,1,"R"]
grid = [["" for i in range(6)] for j in range(6)]
for i in range(9):
    inp = input()
    if i%2 == 0:
        for j in range(4):
            if inp[j] == "1":
                grid[i//2 + 1][j + 1] += "R"
                grid[i//2 + 1][j + 2] += "L"
    else:
        for j in range(5):
            if inp[j] == "1":
                grid[i//2 + 1][j + 1] += "D"
                grid[i//2 + 2][j + 1] += "U"
print(*grid,sep="\n")
while True:
    pos = move(pos)
    if pos[0] == 1 and pos[1] == 1:
        break

Python: def move(position):
    x = position[0]
    y = position[1]
    d = position[2]
    if d == "L":
        p = "DLUR"
    elif d == "R":
        p = "URDL"
    elif d == "U":
        p = "LURD"
    else:
        p = "RDLU"
    for i in range(4):
        if p[i] in grid[y][x]:
            d = p[i]
            if d == "L":
                print("L",end="")
                x -= 1
                break
            elif d == "R":
                print("R",end="")
                x += 1
                break
            elif d == "U":
                print("U",end="")
                y -= 1
                break
            else:
                print("D",end="")
                y += 1
                break
    return [x, y, d]

pos = [1,1,"R"]
grid = [["" for i in range(6)] for j in range(6)]
for i in range(9):
    inp = input()
    if i%2 == 0:
        for j in range(4):
            if inp[j] == "1":
                grid[i//2 + 1][j + 1] += "R"
                grid[i//2 + 1][j + 2] += "L"
    else:
        for j in range(5):
            if inp[j] == "1":
                grid[i//2 + 1][j + 1] += "D"
                grid[i//2 + 2][j + 1] += "U"
print(*grid,sep="\n")
while True:
    pos = move(pos)
    if pos[0] == 1 and pos[1] == 1:
        break

Python: g=[[0]*5 for _ in[0]*5]
for i in range(9):
 e=input()
 for j in range(4+i%2):
  if int(e[j]):
   if i%2:g[i//2][j]+=4;g[i//2+1][j]+=1
   else:r=g[i//2];r[j]+=2;r[j+1]+=8
y,x=0,1
k=1
a=[1]
while 1:
 k+=2
 for _ in[0]*4:
  k+=1
  if g[y][x]&int(2**(k%4)):a+=[k%4];break
 if k%2:x+=1-2*((k%4)>1)
 else:y+=2*((k%4)>0)-1
 if x+y==0:break
print(''.join('URDL'[c]for c in a))

Python: import sys
f = sys.stdin


board = [[0 for i in range(11)] for j in range(11)]
for i, line in enumerate(f):
    for j, c in enumerate(line.strip()):
        board[i + 1][1 + (i + 1) % 2 + j * 2] = int(c)

step = {(-1, 0 ):'L',(0, -1 ):'U',(1, 0 ):'R',(0, 1):'D'}
    
    
start = pre_loc = 1 + 1j
loc = 3 + 1j
print('R',end='')
while loc != start:
    for direct in [(pre_loc - loc) / 2 * 1j ** (i + 1) for i in range(3)]:
        if board[int(loc.imag + direct.imag)][int(loc.real + direct.real)]:
            pre_loc = loc
            loc += direct * 2
            print(step[(direct.real,direct.imag)],end='')
            break
print()

Python: g=[[0]*5 for _ in[0]*5]
for i in range(9):
 e=input()
 for j in range(4+i%2):
  if int(e[j]):
   if i%2:g[i//2][j]+=4;g[i//2+1][j]+=1
   else:r=g[i//2];r[j]+=2;r[j+1]+=8
y,x,k=0,1,1
a='1'
while 1:
 k=k%4+2
 for _ in[0]*4:
  k+=1
  if g[y][x]&int(2**(k%4)):a+=str(k%4);break
 if k%2:x+=[1,-1][(k%4)>1]
 else:y+=[-1,1][(k%4)>0]
 if x+y==0:break
print(''.join('URDL'[int(c)]for c in a))

Python: def move(position):
    x = position[0]
    y = position[1]
    d = position[2]
    if d == "L":
        p = "DLUR"
    elif d == "R":
        p = "URDL"
    elif d == "U":
        p = "LURD"
    else:
        p = "RDLU"
    for i in range(4):
        if p[i] in grid[y][x]:
            d = p[i]
            if d == "L":
                print("L",end="")
                x -= 1
                break
            elif d == "R":
                print("R",end="")
                x += 1
                break
            elif d == "U":
                print("U",end="")
                y -= 1
                break
            else:
                print("D",end="")
                y += 1
                break
    return [x, y, d]

pos = [1,1,"R"]
grid = [["" for i in range(6)] for j in range(6)]
for i in range(9):
    inp = input()
    if i%2 == 0:
        for j in range(4):
            if inp[j] == "1":
                grid[i//2 + 1][j + 1] += "R"
                grid[i//2 + 1][j + 2] += "L"
    else:
        for j in range(5):
            if inp[j] == "1":
                grid[i//2 + 1][j + 1] += "D"
                grid[i//2 + 2][j + 1] += "U"
while True:
    pos = move(pos)
    if pos[0] == 1 and pos[1] == 1:
        break

Python: def solve():
    pipes = [[0 for _ in range(6)]]
    pipes.extend([list(map(int, '0{0}0'.format(input()))) for _ in range(9)])
    pipes.extend([[0 for _ in range(6)]])
    last_dirction = 2
    x, y = 1, 1
    while True:
        next_direction = (last_dirction - 1) % 4
        while True:
            if next_direction == 0:
                nx, ny = x, 2*y - 2
                if pipes[ny][nx] == 1:
                    print('U', end='')
                    x, y = x, y - 1
                    break
            elif next_direction == 1:
                nx, ny = x, 2*y - 1
                if pipes[ny][nx] == 1:
                    print('R', end='')
                    x, y = x + 1, y
                    break
            elif next_direction == 2:
                nx, ny = x, 2*y
                if pipes[ny][nx] == 1:
                    print('D', end='')
                    x, y = x, y + 1
                    break
            else:
                nx, ny = x - 1, 2*y - 1
                if pipes[ny][nx] == 1:
                    print('L', end='')
                    x, y = x - 1, y
                    break
            next_direction = (next_direction + 1) % 4
        last_dirction = next_direction
        if x == 1 and y == 1:
            print()
            break

if __name__ == "__main__":
    solve()