#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1009;
long long ans[MAXN][MAXN];
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  long long n, d, k;
  scanf("%lld%lld%lld", &n, &k, &d);
  int ok = 0;
  long long b = k;
  for (int i = 0; i < d; ++i) {
    if (b >= n) {
      ok = 1;
      break;
    }
    b *= k;
  }
  if (!ok) {
    printf("-1\n");
    return 0;
  }
  for (int i = 1; i < n; ++i) {
    for (int j = 0; j < d; ++j) ans[i][j] = ans[i - 1][j];
    for (int j = d - 1; j >= 0; j--) {
      ans[i][j] = (ans[i][j] + 1) % k;
      if (ans[i][j]) break;
    }
  }
  for (int i = 0; i < d; ++i) {
    for (int j = 0; j < n; ++j) {
      if (j) printf(" ");
      printf("%lld", ans[j][i] + 1);
    }
    printf("\n");
  }
  return 0;
}
