#include <bits/stdc++.h> using namespace std; int m,n,a[105][105],i,jint; cin >> n >> m; for(i = 1; i <= n; i++)for(j = 1; j <= m; j++) cin >> a[i][j]; for(i = 1; i <= m; i++){for(j = n; j >= 1; j--) cout<< a[j][i] << " " ;cout<< endl;} return 0;}