#include <bits/stdc++.h>
using namespace std;
int a[1001][1001];
int main() {
  int n, k, d;
  cin >> n >> k >> d;
  int tmp = 1;
  bool flag = false;
  for (int i = 1; i <= d; i++) {
    tmp *= k;
    if (tmp >= n) {
      flag = true;
      break;
    }
  }
  if (!flag) {
    cout << -1 << endl;
    return 0;
  }
  for (int i = 1; i < n; i++) {
    for (int j = 0; j < d; j++) a[i][j] = a[i - 1][j];
    for (int j = d - 1; j >= 0; j--) {
      a[i][j] = (a[i][j] + 1) % k;
      if (a[i][j]) break;
    }
  }
  for (int i = 0; i < d; i++) {
    cout << a[0][i] + 1;
    for (int j = 1; j < n; j++) cout << ' ' << a[j][i] + 1;
    cout << endl;
  }
  return 0;
}
