#include <bits/stdc++.h>
using namespace std;
int mat[1010][1010], d, n;
int mul(int k, int d) {
  long long ans = 1;
  for (int i = 1; i <= d; i++) {
    ans *= k;
    if (ans >= 9999) return ans;
  }
  return ans;
}
int main() {
  int m, i, j, k;
  while (scanf("%d%d%d", &n, &k, &d) != EOF) {
    if (mul(k, d) < n) {
      puts("-1");
      continue;
    }
    for (i = 1; i <= d; i++) mat[i][1] = 0;
    for (i = 2; i <= n; i++) {
      int kk = 0;
      m = mat[d][i - 1] + 1;
      mat[d][i] = m % k;
      kk = m / k;
      for (j = d - 1; j >= 1; j--) {
        m = kk + mat[j][i - 1];
        mat[j][i] = m % k;
        kk = m / k;
      }
    }
    for (i = 1; i <= d; i++) {
      cout << mat[i][1] + 1;
      for (j = 2; j <= n; j++) printf(" %d", mat[i][j] + 1);
      puts("");
    }
  }
  return 0;
}
