시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 25 6 5 35.714%

문제

로봇과 다섯 개의 큐브가 단위 정사각형으로 나누어진 큰 보드 위에 있다. 로봇과 큐브는 각각 한 정사각형을 모두 차지하는 크기이다.

로봇은 위, 아래, 왼쪽, 오른쪽으로 한 칸 이동할 수 있다. 만약, 로봇이 이동하려는 칸에 큐브가 있다면, 로봇은 큐브를 움직이는 방향으로 한 칸 밀게 된다.

큐브는 흥미로운 자성을 가지고 있다. 두 큐브가 서로 인접한 칸에 있을 때(변을 공유하는 정사각형), 큐브는 붙게되고 한 물체가 된다. 한 물체가 된 큐브는 같이 움직이게 된다. 즉, 로봇이 붙어있는 큐브 중 하나를 밀면, 붙어있는 나머지 큐브도 같은 방향으로 움직인다.

로봇은 다섯 개의 큐브를 모두 붙어있게 하나로 만드려고 한다. 이 때, 위에서 봤을 때, 큐브가 이루는 모습은 T자 모양이어야 한다. (T자가 회전되면 안된다)

큐브의 위치가 주어졌을 때, T자 모양으로 만드는 프로그램을 작성하시오.

입력

입력은 총 다섯 줄이다. 각 줄에는 큐브의 위치 X와 Y가 주어진다. (-5 ≤ X, Y ≤ 5)

로봇은 가장 처음에 (0, 0)에 있고, 여기에는 큐브가 없다.

입력으로 주어지는 큐브가 처음부터 인접하는 상태는 없다. 즉, 변을 공유하는 큐브는 없다. 하지만 꼭지점을 공유할 수는 있다.

출력

로봇이 어떻게 움직여야 하는지 한 줄에 모두 출력한다. 위로 움직이는 것은 U, 왼쪽은 L, 오른쪽은 R, 아래는 D로 출력한다.

로봇이 움직이는 횟수는 9999를 넘을 수 없다.

예제 입력 1

0 1
-1 0
1 0
0 -1
0 -3

예제 출력 1

DRRUUULLDD

힌트

W3sicHJvYmxlbV9pZCI6IjI5OTYiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWQwNTBcdWJlMGMgXHViYWE4XHVjNzNjXHVhZTMwIiwiZGVzY3JpcHRpb24iOiI8cD5cdWI4NW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