410475: GYM104025 A Gifts in box

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

A. Gifts in boxtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

There are some gifts in a box. Each gift is a $$$1 \times 1 \times 1$$$ cube. The width, length, and height of the box are $$$n$$$, $$$m$$$, and $$$h$$$ respectively, as shown in Figure 1. The gifts are neatly placed in the box and we can use an $$$n \times m$$$ matrix $$$A$$$ to represent them. If we look at the box from the top there are $$$A_{i,j}$$$ gifts at $$$i$$$-th row, $$$j$$$-th column.

Fig. 1. the original box

Now we carefully turn the box and make its opening facing to us, as shown in Figure 2. Then we want to use another $$$h \times m$$$ matrix $$$B$$$ to represent the gifts. If we look at the box from the top there are $$$B_{i,j}$$$ gifts at $$$i$$$-th row, $$$j$$$-th column.

Fig. 2. the turned box
Input

The first line contains three integers $$$n, m, h\ (1 \leq n, m, h \leq 100)$$$.

For the next $$$n$$$ lines, each contains $$$m$$$ integers. The $$$j$$$-th integer in the $$$i$$$-th line is $$$A_{i,j}$$$.

Output

Output $$$h$$$ lines, each contains $$$m$$$ integers. The $$$j$$$-th integer in the $$$i$$$-th line is $$$B_{i,j}$$$.

ExampleInput
3 4 5
1 2 3 4
2 0 1 5
1 3 2 2
Output
3 2 3 3
1 2 2 3
0 1 1 2
0 0 0 2
0 0 0 1
Note

You should take gravity into consideration.

加入题单

算法标签: