#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  int n, k, d;
  cin >> n >> k >> d;
  vector<vector<int> > answer(n, vector<int>(d));
  long long base = 1;
  for (int i = 0; i < d; ++i) {
    for (int j = 0; j < n; ++j) {
      answer[j][i] = (j / base) % k + 1;
    }
    base = min<long long>(base * k, n);
  }
  sort(answer.begin(), answer.end());
  bool accept = true;
  for (int i = 0; i + 1 < n; ++i) {
    if (answer[i] == answer[i + 1]) {
      accept = false;
    }
  }
  if (!accept) {
    cout << -1 << endl;
    return 0;
  }
  for (int i = 0; i < d; ++i) {
    for (int j = 0; j < n; ++j) {
      if (j != 0) {
        cout << " ";
      }
      cout << answer[j][i];
    }
    cout << endl;
  }
  return 0;
}
