#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
long long cl(long double a) {
  if (a > (long long)a) {
    return (long long)a + 1;
  } else {
    return (long long)a;
  }
}
long long flr(long double a) { return (long long)a; }
const long long M = 1010;
long long ans[M][M];
void solve() {
  long long n, k, d;
  cin >> n;
  cin >> k;
  cin >> d;
  long long pos = 1;
  bool flag = false;
  for (long long i = 0; i < d; i++) {
    pos *= k;
    if (pos >= n) {
      flag = true;
      break;
    }
  }
  if (!flag) {
    cout << -1 << "\n";
    return;
  }
  long long op;
  long long f = 1;
  for (long long i = 0; i < n; i++) {
    op = f;
    for (long long j = 0; j < d; j++) {
      ans[i][j] = op % k;
      op /= k;
    }
    f++;
  }
  for (long long j = 0; j < d; j++) {
    for (long long i = 0; i < n; i++) {
      cout << ans[i][j] + 1 << " ";
    }
    cout << "\n";
  }
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t;
  t = 1;
  while (t--) solve();
}
