#include <bits/stdc++.h>
using namespace std;
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  for (auto x : v) os << x << " ";
  return os;
}
template <typename T>
ostream& operator<<(ostream& os, const set<T>& v) {
  for (auto it : v) os << it << " ";
  return os;
}
template <typename T, typename S>
ostream& operator<<(ostream& os, const map<T, S>& v) {
  for (auto it : v) os << it.first << " : " << it.second << "\n";
  return os;
}
template <typename T, typename S>
ostream& operator<<(ostream& os, const pair<T, S>& v) {
  os << "(";
  os << v.first << ", " << v.second << ")";
  return os;
}
template <typename T>
istream& operator>>(istream& in, vector<T>& v) {
  for (T& it : v) in >> it;
  return in;
}
map<long long, long long> counts(const vector<long long>& v) {
  map<long long, long long> m;
  for (auto x : v) {
    m[x]++;
  }
  return m;
}
map<char, long long> counts(const string& s) {
  map<char, long long> m;
  for (auto x : s) {
    m[x]++;
  }
  return m;
}
vector<long long> next_perm(vector<long long> a, long long k) {
  for (long long i = a.size() - 1; i >= 0; i--) {
    if (a[i] != k) {
      a[i]++;
      break;
    } else {
      a[i] = 1;
    }
  }
  return a;
}
void solve() {
  long long n, k, d;
  cin >> n >> k >> d;
  if (n > pow(k, d)) {
    cout << -1;
    return;
  }
  vector<long long> nums(d, 1);
  vector<vector<long long> > seq(d, vector<long long>(n));
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < d; j++) {
      seq[j][i] = nums[j];
    }
    nums = next_perm(nums, k);
  }
  for (long long i = 0; i < d; i++) {
    cout << seq[i] << endl;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  solve();
  return 0;
}
