#include <bits/stdc++.h>
using namespace std;
bool binpow(long long a, long long n, long long c) {
  long long b = 1;
  while (n > 0) {
    if (n & 1) b *= a;
    a *= a;
    n >>= 1;
    if (b >= c) return true;
    if (a >= c && n != 0) return true;
  }
  return false;
}
long long binpow1(long long a, long long n) {
  long long b = 1;
  while (n > 0) {
    if (n & 1) b *= a;
    a *= a;
    n >>= 1;
    if (b >= 1000) return 1000;
    if (a >= 1000 && n != 0) return 1000;
  }
  return b;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long n, k, d;
int res[1100][1100];
void solve() {
  cin >> n >> k >> d;
  if (!binpow(k, d, n)) {
    cout << "-1\n";
    return;
  }
  long long p = 0;
  for (int i = 1; i <= d; i++) {
    p = binpow1(k, d - i);
    int j = 1;
    int z = 1;
    while (j <= n) {
      for (int l = 0; l < p; l++, j++) res[i][j] = z;
      z++;
      if (z == k + 1) z = 1;
    }
  }
  for (int i = 1; i <= d; i++) {
    for (int j = 1; j <= n; j++) cout << res[i][j] << " ";
    cout << endl;
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  solve();
  return 0;
}
