Start: Nov, 12, 2017 10:00:00
2017秋Python程序设计基础培训第三次作业
End: Nov, 19, 2017 12:00:00
Time elapsed:
Time remaining:

Problem_ID: D
Result: Accepted
Time: 95ms
Memory: 24436kB
Author: shanzhenyu
In contest: 1123

def xuanzhuan(a):
    n,m = len(a),len(a[0])
    b = [[0 for j in range(n)] for i in range(m)]
    for i in range(len(b)):
       for j in range(len(b[0])):
           b[i][j]=a[n-1-j][i]            
    return b
    
for case in range(int(input())):
    n,m,k = list(map(int, input().split()))
    a = []
    for i in range(n):
        a.append(list(map(int, input().split())))

    i = k%4
    while i>0:
        a = xuanzhuan(a)
        i -= 1
        
    for i in range(len(a)):
        for j in range(len(a[0])-1):
            print(a[i][j],end=" ")
        print(a[i][-1])
    print("")