#include <bits/stdc++.h>
using namespace std;
long long d1;
long long m;
long long n;
long long mas[5000][5000];
bool f = false;
void rec(long long hod, long long start, long long h) {
  if (hod > d1) {
    return;
  }
  long long m1 = 1;
  for (long long i = start; i <= n; i += h) {
    mas[hod][i] = m1;
    m1++;
    if (m1 > m) {
      m1 = 1;
    }
  }
  m1 = 1;
  for (long long i = start; i <= n; i += h) {
    if (m1 > m) {
      break;
    }
    rec(hod + 1, i, h * m);
    m1++;
  }
}
int main() {
  long long d;
  cin >> n >> m >> d;
  int k = 0;
  int t = 1;
  while (t < n) {
    t *= m;
    k++;
    if (k > d) {
      cout << -1 << endl;
      return 0;
    }
  }
  d1 = min(d, (long long)k);
  d1 = max(d1, (long long)1);
  rec(1, 1, 1);
  for (int i = 1; i <= d; i++) {
    if (i <= d1) {
      for (int j = 1; j <= n; j++) {
        printf("%lld ", mas[i][j]);
      }
    } else {
      for (int j = 1; j <= n; j++) {
        printf("%lld ", mas[1][j]);
      }
    }
    cout << endl;
  }
  return 0;
}
