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