#include <bits/stdc++.h>
using namespace std;
int v[1010];
int ans[1010][1010];
int main() {
  int n, k, d;
  scanf(" %d %d %d", &(n), &(k), &(d));
  int pot = 1;
  for (int i = 0; i < (d); ++i) {
    pot *= k;
    if (pot >= n) {
      break;
    }
  }
  if (n > pot) {
    printf("-1\n");
    return 0;
  }
  for (int i = 0; i < (n); ++i) {
    for (int j = 0; j < (d); ++j) {
      ans[j][i] = v[j] + 1;
    }
    int carry = 1;
    for (int i = 0; i < (d); ++i) {
      int nval = v[i] + carry;
      carry = nval / k;
      v[i] = nval % k;
    }
  }
  for (int i = 0; i < (d); ++i) {
    for (int j = 0; j < (n); ++j) {
      if (j) printf(" ");
      printf("%d", ans[i][j]);
    }
    printf("\n");
  }
}
