#include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
int a=1;
while(t--){
int n;
cin>>n;
vector<vector<int>> matrix(n,vector<int>(n));
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
cin>>matrix[i][j];
}
}
cout<<"Test Case #"<<a<<":\n";
for(int i=0;i<n;i++){
for(int j=n-1;j>=0;j--){
cout<<matrix[j][i]<<" ";
}
cout<<endl;
}
a++;
}
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CmludCBtYWluKCkKewogICAgaW50IHQ7CiAgICBjaW4+PnQ7CiAgICBpbnQgYT0xOwogICAgd2hpbGUodC0tKXsKICAgIAlpbnQgbjsKICAgIAljaW4+Pm47CiAgICAJdmVjdG9yPHZlY3RvcjxpbnQ+PiBtYXRyaXgobix2ZWN0b3I8aW50PihuKSk7CiAgICAJZm9yKGludCBpPTA7aTxuO2krKyl7CiAgICAJCWZvcihpbnQgaj0wO2o8bjtqKyspewogICAgCQkJY2luPj5tYXRyaXhbaV1bal07IAogICAgCQl9CiAgICAJfQogICAgCWNvdXQ8PCJUZXN0IENhc2UgIyI8PGE8PCI6XG4iOwogICAgCWZvcihpbnQgaT0wO2k8bjtpKyspewogICAgCQlmb3IoaW50IGo9bi0xO2o+PTA7ai0tKXsKICAgIAkJCWNvdXQ8PG1hdHJpeFtqXVtpXTw8IiAiOwogICAgCQl9CiAgICAJCWNvdXQ8PGVuZGw7CiAgICAJfQogICAgCWErKzsKICAgIH0KfQ==
NAoxCjEKMgoxIDIKNCAzCjMKMSAyIDMKOCA5IDQKNyA2IDUKNQotNDQgMjUgLTUyIDY5IC01IAoxNyAyMiA1MSAyNyAtNDQgCi03OSAyOCAtNzggMSAtNDcgCjY1IC03NyAtMTQgLTIxIC02IAotOTYgNDMgLTIxIC0yMCA5MA==
4
1
1
2
1 2
4 3
3
1 2 3
8 9 4
7 6 5
5
-44 25 -52 69 -5
17 22 51 27 -44
-79 28 -78 1 -47
65 -77 -14 -21 -6
-96 43 -21 -20 90