#include <bits/stdc++.h>
using namespace std;
int dig[1005][1005];
int main() {
  int n, d, k;
  cin >> n >> k >> d;
  if (k == 1) {
    if (n == 1) {
      for (int i = 0; i < d; i++) {
        cout << 1 << endl;
      }
    } else
      cout << -1 << endl;
    return 0;
  }
  int r = ceil(log(n) / log(k));
  if (r > d)
    cout << -1 << endl;
  else {
    for (int i = 0; i < n; i++) {
      int j = 0;
      int num = i;
      while (num > 0) {
        dig[i][j] = num % k;
        num /= k;
        j++;
      }
    }
    for (int i = 0; i < d; i++) {
      for (int j = 0; j < n; j++) {
        cout << dig[j][i] + 1 << " ";
      }
      cout << endl;
    }
  }
}
