#include <bits/stdc++.h>
using namespace std;
int ans[2000][2000];
int main() {
  long long n, k, d, f = 0;
  cin >> n >> k >> d;
  long long x = 1;
  for (int i = 1; i <= d; i++) {
    x *= k;
    if (x >= n) {
      f = 1;
      break;
    }
  }
  if (!f) {
    cout << -1 << endl;
    return 0;
  }
  for (int i = 0; i < n; i++) {
    int l = i, j = 0;
    while (l > 0) {
      ans[j++][i] = l % k;
      l /= k;
    }
  }
  for (int i = 0; i < d; i++) {
    for (int j = 0; j < n; j++) cout << ans[i][j] + 1 << " ";
    cout << endl;
  }
}
