#include <bits/stdc++.h>
using namespace std;
const int INF = 2e9 + 9;
void f(vector<int> &V, int k) {
  reverse((V).begin(), (V).end());
  for (int i = 0; i < (int)((int)(V.size())); i++) {
    if (V[i] != k) {
      V[i]++;
      reverse((V).begin(), (V).end());
      return;
    }
    V[i] = 1;
  }
  reverse((V).begin(), (V).end());
  return;
}
int fi(int n, int b) {
  n--;
  if (b == 1) return INF;
  int ans = 0;
  while (n) {
    ans++;
    n /= b;
  }
  return ans;
}
int main() {
  int n, d, k;
  cin >> n >> k >> d;
  if (n == 1 and k == 1) {
    for (int i = 0; i < (int)(d); i++) cout << 1 << endl;
    return 0;
  }
  if (fi(n, k) > d) {
    cout << -1 << endl;
    return 0;
  }
  vector<int> V(d, 1);
  vector<vector<int> > ans;
  for (int i = 0; i < (int)(n); i++) {
    ans.push_back(V);
    f(V, k);
  }
  for (int i = 0; i < (int)(d); i++) {
    for (int j = 0; j < (int)(n); j++) cout << ans[j][i] << " ";
    cout << endl;
  }
}
