#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, k, d;
  cin >> n >> k >> d;
  int t = 0;
  int K = 1;
  while (K <= 1000 and t < d) {
    K *= k;
    t++;
  }
  if (n > K) {
    cout << -1 << "\n";
    return 0;
  }
  vector<int> kid(n);
  for (int i = 0; i < n; ++i) {
    kid[i] = i;
  }
  for (int i = 0; i < d; ++i) {
    for (int j = 0; j < n; ++j) {
      cout << (kid[j] % k + 1) << " ";
      kid[j] /= k;
    }
    cout << "\n";
  }
}
