#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define rep(i,l,r) for(auto i = (l); i < (r); ++i) #define drep(i,l,r) for(auto i = (r)-1; i >= (l); --i) #define all(x) x.begin(),x.end() #define rall(x) x.rbegin(),x.rend() using namespace std; using uint = unsigned int; using ll = long long; using ull = unsigned long long; using pii = pair; using pli = pair; using pil = pair; using pll = pair; template using Pq = priority_queue; template using pQ = priority_queue, greater>; template inline bool chmin(T& a, const U& b) { if (a > b) { a = b; return true; } return false; } template inline bool chmax(T& a, const U& b) { if (a < b) { a = b; return true; } return false; } inline void yesno(bool p) { if (p) cout << "Yes\n"; else cout << "No\n"; } const int INF = numeric_limits::max(); const ll LINF = numeric_limits::max(); void testcase(); int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); cout << fixed << setprecision(20); int T = 1; // cin >> T; rep(i,0,T) testcase(); return 0; } void testcase(){ int n,m,k; cin>>n>>m>>k; vector a(n,vector(n)); int now = 1; rep(i,0,k)rep(j,0,k){ a[i][j] = now; now++; if(now>m) now = 1; } rep(i,0,n)rep(j,0,n) a[i][j] = a[i%k][j%k]; rep(i,0,n)rep(j,0,n)cout<