#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
const int Inf = 0x3f3f3f3f;
int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || '9' < ch) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while ('0' <= ch && ch <= '9') x = x * 10 + ch - 48, ch = getchar();
  return x * f;
}
int n, k, d, t;
int a[1005][1005];
int main() {
  n = t = read();
  k = read();
  d = read();
  for (int i = 1; i <= d; ++i) t = t / k + (int)(t % k > 0);
  if (t == 1) {
    memset(a, 0, sizeof(a));
    for (int i = 0; i < n; ++i) {
      int tmp = i, j = 1;
      while (tmp) {
        a[j++][i] = tmp % k;
        tmp /= k;
      }
    }
    for (int i = 1; i <= d; ++i) {
      for (int j = 0; j < n; ++j) printf("%d ", a[i][j] + 1);
      puts("");
    }
  } else
    puts("-1");
  return 0;
}
