#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1);
long long int n, k, d;
int anss[1001][1001];
int main() {
  bool ans = false;
  cin >> n >> k >> d;
  long long int temp = 1;
  for (int i = 1; i <= d; ++i) {
    temp *= k;
    if (temp >= n) {
      ans = true;
      break;
    }
  }
  if (!ans) {
    cout << -1 << endl;
  } else {
    for (int i = 1; i <= d; ++i) anss[i][1] = 1;
    for (int s = 2; s <= n; ++s) {
      int carry = 1;
      for (int i = 1; i <= d; ++i) {
        if (carry == 1) {
          anss[i][s] = (anss[i][s - 1] % k + carry);
          carry = (anss[i][s - 1] == k);
        } else {
          anss[i][s] = anss[i][s - 1];
          carry = 0;
        }
      }
    }
    for (int i = 1; i <= d; ++i) {
      for (int j = 1; j <= n; ++j) cout << anss[i][j] << " ";
      cout << endl;
    }
  }
}
