#include <bits/stdc++.h>
using namespace std;
int students[1100][1100];
int main() {
  bool flag = true;
  int n, k, d, tmp = 1;
  cin >> n >> k >> d;
  for (int i = 0; i < d && flag; i++) {
    tmp *= k;
    if (tmp >= n) flag = false;
  }
  if (flag)
    cout << "-1 \n";
  else {
    for (int i = 1; i < n; i++) {
      int tmp = 1;
      for (int j = 0; j < d; j++) {
        students[i][j] = students[i - 1][j] + tmp;
        if (students[i][j] >= k)
          students[i][j] = 0;
        else
          tmp = 0;
      }
    }
    for (int i = 0; i < d; i++) {
      for (int j = 0; j < n; j++) cout << students[j][i] + 1 << ' ';
      cout << endl;
    }
  }
}
