#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k, d, x;
  cin >> n >> k >> d;
  int i, j;
  x = 1;
  for (i = 0; i < d && x < n; ++i) {
    x = x * k;
  }
  if (x < n) {
    printf("-1\n");
    return 0;
  }
  x /= k;
  x = max(1LL, x);
  int c = 0;
  for (i = 0; i < d; ++i) {
    c = -1;
    for (j = 0; j < n; ++j) {
      if (j % x == 0) {
        c = (c + 1) % k;
      }
      printf("%d ", c + 1);
    }
    putchar('\n');
    x = max(1LL, x / k);
  }
}
