#include <bits/stdc++.h>
using namespace std;
int nxt() {
  int res;
  scanf("%d", &res);
  return res;
}
inline void solve() {
  int n = nxt();
  int k = nxt();
  int d = nxt();
  vector<vector<int> > ans;
  ans.push_back(vector<int>(d, 0));
  while (int(ans.size()) < n) {
    vector<int> q = ans.back();
    int add = 1;
    for (int i = 0; i < d && add; ++i) {
      q[i] += add;
      add = 0;
      if (q[i] >= k) {
        q[i] -= k;
        add = 1;
      }
    }
    if (add) {
      break;
    }
    ans.push_back(q);
  }
  if (int(ans.size()) != n) {
    cout << "-1\n";
    return;
  }
  for (int i = 0; i < d; ++i) {
    for (int j = 0; j < n; ++j) {
      cout << ans[j][i] + 1 << " ";
    }
    cout << "\n";
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  solve();
  return 0;
}
