L. Lost Cargo
time limit per test
2 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output

This is an interactive problem.

A team of divers is surveying the cargo of the Zenobia, a shipwreck off the coast of Larnaca. In one section of its cargo deck, rectangular containers completely cover an $$$n \times m$$$ grid. Each container occupies exactly two cells sharing a side, and each cell belongs to exactly one container.

The boundaries between the containers are hidden by sediment. The divers can inspect individual cells to identify the containers. Each inspection takes time, so the number of inspections is limited.

Rows are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and columns from $$$1$$$ to $$$m$$$ from left to right. You can inspect a cell $$$(x,y)$$$. The reply describes which half of its container occupies the cell:

  • U: the upper half of a vertical container; its other half is at $$$(x+1,y)$$$;
  • D: the lower half of a vertical container; its other half is at $$$(x-1,y)$$$;
  • L: the left half of a horizontal container; its other half is at $$$(x,y+1)$$$;
  • R: the right half of a horizontal container; its other half is at $$$(x,y-1)$$$.

Reconstruct the arrangement of all containers using at most $$$\lfloor nm/4\rfloor$$$ queries. The arrangement is fixed before the interaction starts and does not change in response to your queries.

Interaction

First you need to read two integers $$$n$$$ and $$$m$$$ ($$$1 \le n,m \le 100$$$), the number of rows and columns. It is guaranteed that $$$nm$$$ is even.

To inspect a cell, print a line of the form ? x y, where $$$1 \le x \le n$$$ and $$$1 \le y \le m$$$. The interactor replies with one of U, D, L, or R on a separate line. Repeated queries are allowed, but each counts toward the limit.

When you have reconstructed the tiling, print a line containing !, followed by $$$n$$$ lines of $$$m$$$ characters each. Character $$$y$$$ of line $$$x$$$ must be the half occupying cell $$$(x,y)$$$, using the same U, D, L, and R notation. Your answer must match the hidden tiling exactly. Printing the final answer does not count as a query. Then terminate your program.

After printing each query and after printing the final answer, flush the output buffer. For example, use cout.flush() in C++ or sys.stdout.flush() in Python.

If you make an invalid query or exceed the query limit, your solution will be judged incorrect. If you read -1 or reach the end of input while expecting a reply, terminate immediately.

Example
Input
3 2

D
Output

? 2 2

!
UU
DD
LR