... How much time till sky net takes over humanity? ...
There is a field that can be represented as a grid with rows and columns. Each cell has a direction: right (R), down (D), left (L), or up (U).
There are some restrictions on the directions of the cells:
A cell cannot point outside of the grid;
Every cell has exactly one cell that points to it.
From any cell, we can repeatedly follow directions and obtain a walk: (r_1,c_1),(r_2,c_2),\ldots, where for every i\ge 1 the cell (r_i,c_i) points to (r_{i+1},c_{i+1}).
A walk (r_1,c_1),(r_2,c_2),\ldots,(r_k,c_k) is called enclosed if:
k \ge 2;
(r_1,c_1)=(r_k,c_k);
All cells (r_1,c_1),(r_2,c_2),\ldots,(r_{k-1},c_{k-1}) are pairwise distinct.
A grid is called beautiful if the cells of the grid can be partitioned into exactly two enclosed walks.
Construct a beautiful grid, or determine that it is impossible to do so.
The first line contains two integers and (1 \le n, m \le 100) — the size of the grid.
On the first line output "YES" if the field exists, and "NO" otherwise.
If the answer is YES, on the following lines output characters from {R, D, L, U} — the description of the grid.
Example 1
Example 2
In the first example, the output grid is:
RRD
ULL
DLL
RRU
It can be represented as exactly two enclosed walks. For instance:
(1,1)\to(1,2)\to(1,3)\to(2,3)\to(2,2)\to(2,1)\to(1,1).
(3,1)\to(4,1)\to(4,2)\to(4,3)\to(3,3)\to(3,2)\to(3,1).
Both enclosed walks follow the arrows, are disjoint, and together contain all n \cdot m cells. Therefore, the output is valid.
In the second example, it can be shown that it is impossible to construct a beautiful 3 \times 3 grid.
( points) n=m=2;
( points) n=m=4;
( points) n=2;
( points) n=4;
( points) Both and are even;
( points) No additional restrictions.