#include <bits/stdc++.h>
using namespace std;
int arr[2][1005];
int main() {
  int n, k, d, a, c = 1;
  cin >> n >> k >> d;
  a = n / k + (n % k != 0);
  while (c <= d && a > 1) {
    a = a / k + (a % k != 0);
    c++;
  }
  if (c > d) {
    puts("-1");
    return 0;
  }
  for (int i = 0; i < n; i++) {
    arr[0][i] = i % k;
    printf("%d ", arr[0][i] + 1);
  }
  puts("");
  int lim = n / k, indx;
  bool t = 0;
  for (int j = 1; j < d; j++) {
    t = !t;
    indx = 0;
    for (int i = 0; i <= lim; i++) {
      for (int ii = 0; ii < k && indx < n; ii++) arr[t][indx++] = arr[!t][i];
    }
    for (int i = 0; i < n; i++) printf("%d ", arr[t][i] + 1);
    puts("");
  }
  return 0;
}
