#include <bits/stdc++.h>
using namespace std;
int bus[1001][1001];
int main() {
  long long int n, k, d, o = 1, p, i, j, g, ar;
  bool check = true;
  cin >> n >> k >> d;
  for (i = 0; i < d + 1; i++) {
    ar = 0;
    for (j = 0; j < n; j++) {
      if (j % o == 0 && j != 0) ar = (ar + 1) % k;
      bus[i][j] = ar;
    }
    if (o * k < n)
      o *= k;
    else
      o = n;
  }
  if (k == 1) check = false;
  for (i = 0; i < n - 1; i++)
    if (bus[d][i] != bus[d][i + 1]) check = false;
  if (!check && !(n == 1))
    cout << -1 << "\n";
  else
    for (i = 0; i < d; i++) {
      for (j = 0; j < n; j++) {
        cout << bus[i][j] + 1 << " ";
      }
      cout << "\n";
    }
}
