using System;
using System.Collections.Generic;

namespace test
{
    class Program
    {
        struct Point
        {
            public int x;
            public int y;

            public Point(int x, int y)
            {
                this.x = x;
                this.y = y;
            }
        }

        static void Main(string[] args)
        {
            List<string> resultList = new List<string>();

            string input;
            List<string> WallList = new List<string>();
            while((input = Console.ReadLine()) != null)
            {
                WallList.Add(input);
            }

            Point point = new Point(0, 0);
            string course = "R";

            do
            {
                switch (course)
                {
                    case "R":
                        if (point.y != 0 && WallList[2 * point.y - 1][point.x] == '1')
                        {
                            point.y--;
                            course = "U";
                        }
                        else if (point.x != 4 && WallList[2 * point.y][point.x] == '1')
                        {
                            point.x++;
                            course = "R";
                        }
                        else if (point.y != 4 && WallList[2 * point.y + 1][point.x] == '1')
                        {
                            point.y++;
                            course = "D";
                        }
                        else
                        {
                            point.x--;
                            course = "L";
                        }
                        break;
                    case "L":
                        if (point.y != 4 && WallList[2 * point.y + 1][point.x] == '1')
                        {
                            point.y++;
                            course = "D";
                        }
                        else if (point.x != 0 && WallList[2 * point.y][point.x - 1] == '1')
                        {
                            point.x--;
                            course = "L";
                        }
                        else if (point.y != 0 && WallList[2 * point.y - 1][point.x] == '1')
                        {
                            point.y--;
                            course = "U";
                        }
                        else
                        {
                            point.x++;
                            course = "R";
                        }
                        break;
                    case "U":
                        if (point.x != 0 && WallList[2 * point.y][point.x - 1] == '1')
                        {
                            point.x--;
                            course = "L";
                        }
                        else if (point.y != 0 && WallList[2 * point.y - 1][point.x] == '1')
                        {
                            point.y--;
                            course = "U";
                        }
                        else if (point.x != 4 && WallList[2 * point.y][point.x] == '1')
                        {
                            point.x++;
                            course = "R";
                        }
                        else
                        {
                            point.y++;
                            course = "D";
                        }
                        break;
                    case "D":
                        if (point.x != 4 && WallList[2 * point.y][point.x] == '1')
                        {
                            point.x++;
                            course = "R";
                        }
                        else if (point.y != 4 && WallList[2 * point.y + 1][point.x] == '1')
                        {
                            point.y++;
                            course = "D";
                        }
                        else if (point.x != 0 && WallList[2 * point.y][point.x - 1] == '1')
                        {
                            point.x--;
                            course = "L";
                        }
                        else
                        {
                            point.y--;
                            course = "U";
                        }
                        break;
                }
                resultList.Add(course);
            }
            while (point.x != 0 || point.y != 0);

            foreach (string s in resultList)
            {
                Console.Write(s);
            }

            Console.WriteLine();

        }


    }
}

Measured memory_bytes: 5468