#include <bits/stdc++.h>
using namespace std;
int f[2000];
int main() {
  int n, d, k;
  scanf("%d%d%d", &n, &k, &d);
  long long counter = 1;
  bool ff = 0;
  for (int i = 0; i < d; i++) {
    counter *= k;
    if (counter >= n) {
      ff = 1;
      break;
    }
  }
  if (!ff) {
    printf("-1\n");
    return 0;
  }
  for (int i = 1; i <= n; i++) f[i] = i;
  for (int i = 1; i <= d; i++) {
    for (int j = 1; j <= n; j++) {
      cout << f[j] % k + 1;
      if (j == n)
        printf("\n");
      else
        printf(" ");
      f[j] /= k;
    }
  }
}
