#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, k, d;
  cin >> n >> k >> d;
  int aux = 1;
  for (int i = 0; i < d; ++i) {
    aux *= k;
    if (aux > n) break;
  }
  if (aux < n) {
    cout << "-1\n";
    return 0;
  }
  vector<vector<int> > ans(d, vector<int>(n));
  for (int i = 0; i < n; ++i) {
    int u = i;
    for (int j = 0; j < d; ++j) {
      ans[j][i] = (u % k) + 1;
      u /= k;
    }
  }
  for (int i = 0; i < d; ++i) {
    for (int j = 0; j < n; ++j) {
      cout << ans[i][j] << " ";
    }
    cout << "\n";
  }
  return 0;
}
