The tangram is a dissection puzzle consisting of seven flat shapes, called tans, which are put together to form shapes. For example, we can use the given seven tans to form a bird as follows:

In this problem, let’s play a simplified tangram. You are asked to form a shape on a M*N (0<M,N≦50) board, which is initially plotted a symbol ’-’ at each location. Now, we consider only two tans as follows:

Specifically, when rotating a tan, the tan is fixed at its vertex, and rotated clockwise (by degrees 0, 90, 180, or 270.)
The input contains several lines. The first line contains two numbers representing the board’s height and width. The following line contains one symbol and four numbers. The first symbol represents the tan you should put on board. The second number represents the rotating degree of the tan. The third number represents the height or side of the tan. The fourth and fifth numbers represent the coordinate of the tan’s vertex.
An input line containing only ’x’ represents the end of the input.
The output should print the M*N board. Note that there's a '\n' at the end of last line.