#include <bits/stdc++.h>
const int N = 1200;
using namespace std;
int a[N][N];
int main() {
  int n, k, d;
  while (~scanf("%d%d%d", &n, &k, &d)) {
    if (double(n) > pow((double)k, d))
      printf("-1\n");
    else {
      memset(a, 0, sizeof(a));
      for (int st = 0; st < n; st++) {
        int tmp = st, j = 0;
        while (tmp) {
          a[j][st] = tmp % k;
          tmp /= k;
          j++;
        }
      }
      for (int i = 0; i < d; i++) {
        for (int j = 0; j < n; j++) {
          printf("%d%c", a[i][j] + 1, j == n ? '\n' : ' ');
        }
        printf("\n");
      }
    }
  }
  return 0;
}
