Hide

Problem G
Mirror Images

Atrebla is developing a new smartphone camera app that she believe will be the next big hit on the app store. Camera apps usually display the image mirrored left-to-right on the screen, so that what you see on the screen matches the movement of your face. To help her camera app stand out from the rest, Atrebla will be adding a unique effect that mirrors an image both left-to-right and top-to-bottom. Help her implement this feature.

Input

The first line contains a single integer $T \leq 100$ giving the number of test cases. Each test case starts with a line containing an integer $R$ ($1 \leq R \leq 20$), the number of rows in the image, and an integer $C$ ($1 \leq C \leq 20$), the number of columns. The next $R$ lines contain $C$ characters, all of which are either . or *.

Output

For each test case, output a line containing “Test $x$” where $x$ is the test case number starting from $1$. After that, output the mirrored image.

Sample Input 1 Sample Output 1
2
2 2
.*
..
4 4
***.
**..
....
....
Test 1
..
*.
Test 2
....
....
..**
.***

Please log in to submit a solution to this problem

Log in