Under construction

Still being built. Things may change

Rooftop Garden

Time limit1sMemory limit1024 MB

Summary
Find a walk that traverses each side of the photographed beds exactly once, turning direction at every step, or report NO if none exists.
Level

Medium7 of 10

Topics
Graph, DFS, Implementation
Solved
No attempts yet

Problem

Seoul National University's Shinkonghak Building has a large rooftop garden that only graduate students can see. Square flower beds are arranged in a grid, and walking paths run along the edges of the beds.

Pyeongseok, who will soon lose access to this garden, visited one last time to keep a memory of it. He walked the paths and took photos of the nearby flower beds. On his way back, he realized that the tickets to an overseas game show, which he had kept carefully as a graduation gift, were gone.

He wants to retrace the paths he walked to find the tickets. But he has to return to his lab soon, so he cannot walk every path again. He still has the photos of the beds, so he will check only the paths around those beds first. He has little time, so he will walk each path on the four sides of the photographed beds exactly once, and he will not walk any other path. He also wants to avoid walking in one direction for too long, which can hurt his focus, so he will change his direction every time he passes one side of a bed.

Pyeongseok can start at any point where a horizontal path meets a vertical path. Check whether he can search while meeting these conditions.

Input

The first line has two integers N and M, the number of flower beds in the vertical direction and the number of flower beds in the horizontal direction, where 1≤N,M≤5001 \le N, M \le 500.

The next N lines each contain a string of M characters. The string consists only of the characters # and .. A # marks a bed that Pyeongseok photographed, and a . marks a bed that he did not photograph.

It is guaranteed that at least one bed was photographed.

Output

If Pyeongseok can move while meeting the conditions, print YES on the first line.

On the next line, print the path as a string of the characters L, R, U, and D. Each character means Pyeongseok walks one bed side length to the left, right, up, or down.

If no path satisfies the conditions, print NO on the first line.

Hint

The path in the first sample is shown in the figure below.

route figure

Examples2

  1. Example 1

    Input
    2 3
    ##.
    ..#
    
    Expected output
    YES
    LURDRDRULUL
    
  2. Example 2

    Input
    3 3
    #..
    ..#
    .#.
    
    Expected output
    NO