#include <bits/stdc++.h>
using namespace std;
void fast() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout << setprecision(12) << fixed;
}
void solve() {
  long long n, k, d;
  cin >> n >> k >> d;
  long long pp = 1, f = 0;
  for (long long i = 1; i <= d; i++) {
    pp *= k;
    if (pp >= n) {
      f = i;
      break;
    }
  }
  if (f == 0) {
    cout << -1 << "\n";
    return;
  };
  long long a[n];
  for (long long i = 0; i < n; i++) a[i] = i;
  for (long long i = 0; i < d; i++) {
    for (long long j = 0; j < n; j++) {
      cout << (a[j] % k) + 1 << " ";
      a[j] /= k;
    }
    cout << endl;
  }
}
int main() {
  fast();
  long long t = 1;
  while (t--) {
    solve();
  }
}
