#include <bits/stdc++.h>
using namespace std;
int main() {
  ios ::sync_with_stdio(false);
  int n, k, d;
  cin >> n >> k >> d;
  int temp = 1, j, i = 1, flag = 0;
  while (i <= d) {
    temp *= k;
    i++;
    if (temp >= n) {
      flag = 1;
      break;
    }
  }
  if (flag == 0) {
    cout << -1;
    return 0;
  }
  int ans[n][d];
  for (long long int i = 0; i < n; i++)
    for (long long int j = 0; j < d; j++) ans[i][j] = 0;
  for (i = 1; i < n; i++) {
    for (j = 0; j < d; j++) ans[i][j] = ans[i - 1][j];
    for (j = d - 1; j >= 0; j--) {
      ans[i][j] = (ans[i][j] + 1) % k;
      if (ans[i][j]) break;
    }
  }
  for (i = 0; i < d; i++) {
    for (j = 0; j < n; j++) {
      cout << ans[j][i] + 1 << " ";
    }
    cout << "\n";
  }
}
