#include <bits/stdc++.h>
const int inf = (1 << 30), mod = 1000000007;
using namespace std;
int n, d, k, k1;
int a[1005], go[1005][1005];
void print(int x) {
  if (x == 0) return;
  for (int i = 1; i <= d; i++) go[i][x] = a[i];
  int cur = d;
  a[cur]++;
  while (a[cur] > k) {
    a[cur] = 1;
    a[--cur]++;
  }
  print(x - 1);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> k >> d;
  long long x = 1;
  bool ok = false;
  for (int i = 1; i <= d && !ok; i++) {
    x *= k;
    if (x >= n) ok = true;
  }
  if (!ok) {
    cout << -1;
    return 0;
  }
  for (int i = 1; i <= d; i++) a[i] = 1;
  print(n);
  for (int i = 1; i <= d; i++)
    for (int j = 1; j <= n; j++) {
      cout << go[i][j] << (j == n ? "\n" : " ");
    }
  return 0;
}
