#include #define fi first #define se second #define rep(i,s,n) for (int i = (s); i < (n); ++i) #define rrep(i,g,n) for (int i = (n)-1; i >= (g); --i) #define all(a) a.begin(),a.end() #define rall(a) a.rbegin(),a.rend() #define len(x) (int)(x).size() #define dup(x,y) (((x)+(y)-1)/(y)) #define pb push_back #define eb emplace_back #define Field(T) vector> using namespace std; using ll = long long; using ull = unsigned long long; template using pq = priority_queue,greater>; using P = pair; templatebool chmax(T&a,T b){if(abool chmin(T&a,T b){if(b> n >> m >> k; vector> a(n, vector(n)); int off = 0; rep(i,0,n) { rep(j,0,n) a[i][(j+off)%n] = (j%m)+1; off += k; } rep(i,0,n) { rep(j,0,n) cout << a[i][j] << " "; cout << endl; } return 0; }