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