#30123: 要重複讀取!!!


ningenwoyamaru (よう女の桜)


#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b,c[100][100],d[100][100];
    while(cin>>a>>b){ //小陷阱
        for(int i=0;i<a;i++){
            for(int j=0;j<b;j++){
                cin>>c[i][j];
            }
        }
        for(int i=0;i<a+b;i++){
            for(int j=0;j<a+b;j++){
                d[j][i]=c[i][j];
            }
        }
        for(int i=0;i<b;i++){
            for(int j=0;j<a;j++){
                cout<<d[i][j]<<" ";
            }
            cout<<endl;
        }
    }
}