#include <bits/stdc++.h>
using namespace std;
int t[1002][1002];
int main() {
  int n, d, k;
  cin >> n >> k >> d;
  if (pow(n, 1.0 / (double)d) - (double)k > 1e-9) {
    cout << -1 << endl;
    return 0;
  }
  for (int i = 0; i < n; i++) {
    if (i == 0)
      for (int j = 0; j < d; j++) t[i][j] = 1;
    else {
      for (int j = 0; j < d; j++) t[i][j] = t[i - 1][j];
      t[i][d - 1]++;
      for (int j = d - 1; j >= 0; j--) {
        if (t[i][j] > k) {
          t[i][j - 1] += t[i][j] / k;
          t[i][j] %= k;
        }
      }
    }
  }
  for (int i = 0; i < d; i++) {
    for (int j = 0; j < n; j++) {
      cout << t[j][i] << " ";
    }
    cout << endl;
  }
}
