Start: Jul, 17, 2019 00:00:00
20190717Python程序设计基础培训第三次作业
End: Jul, 21, 2019 00:00:00
Time elapsed:
Time remaining:

Problem_ID: D
Result: Accepted
Time: 50ms
Memory: 25184kB
Author: 15757118136
In contest: 1295

def xz(ls,n,m):
    ls1 = []
    a,b=n-1,0
    for i in range(m):
        ls1.append([])
        for j in range(n):
            ls1[i].append(ls[a][b])
            a = a - 1
        b = b + 1
        a = n - 1
    return ls1

for t in range(int(input())):
    n,m,k = map(int,input().split())
    ls = []
    for i in range(n):
        ls.append(list(map(int,input().split())))

    for i in range(k%4):
        ls = xz(ls,n,m)
        n,m = m,n

    n,m = m,n
    for i in range(m):
        for j in range(n):
            print(ls[i][j],end = ('' if j == n else ' '))
        print()
    print()