Problem: Recently Pashmak has been employed in a transportation company. The company has k buses and has a contract with a school which has n students. The school planned to take the students to d different places for d days (each day in one place). Each day the company provides all the buses for the trip. Pashmak has to arrange the students in the buses. He wants to arrange the students in a way that no two students become close friends. In his ridiculous idea, two students will become close friends if and only if they are in the same buses for all d days.

Please help Pashmak with his weird idea. Assume that each bus has an unlimited capacity.

Input

The first line of input contains three space-separated integers n, k, d (1 ≤ n, d ≤ 1000; 1 ≤ k ≤ 109).

Output

If there is no valid arrangement just print -1. Otherwise print d lines, in each of them print n integers. The j-th integer of the i-th line shows which bus the j-th student has to take on the i-th day. You can assume that the buses are numbered from 1 to k.

Examples

Input

3 2 2


Output

1 1 2 
1 2 1 


Input

3 2 1


Output

-1

Note

Note that two students become close friends only if they share a bus each day. But the bus they share can differ from day to day.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
long long MM = 1000000007;
using namespace std;
long long gcd(long long a, long long b) {
  if (a == 0 || b == 0) return abs(a - b);
  long long res = a % b;
  while (res) {
    a = b;
    b = res;
    res = a % b;
  }
  return b;
}
long long lcm(long long a, long long b) { return a * b / gcd(a, b); }
long long max(long long a, long long b) {
  if (a > b)
    return a;
  else
    return b;
}
long long min(long long a, long long b) {
  if (a < b)
    return a;
  else
    return b;
}
long long numberofdiviser(long long a) {
  long long ans = 0;
  long long i;
  for (i = 1; i * i < a; i++) {
    if (a % i == 0) ans += 2;
  }
  if (i * i == a) ans++;
  return ans;
}
void fival(long long* a, long long b, long long n) {
  for (int i = 0; i < n; i++) {
    a[i] = b;
  }
}
long long sum, ans, l, r, x;
long long ss(vector<long long> a, vector<long long>& b, int ii) {
  for (int i = ii; i < a.size(); i++) {
    b.push_back(a[i]);
    sum += a[i];
    if (b.size() > 1 && sum >= l && sum <= r && b[b.size() - 1] - b[0] >= x)
      ans++;
    ss(a, b, i + 1);
    sum -= b[b.size() - 1];
    b.pop_back();
  }
  return ans;
}
unsigned long long fact(long long n) {
  if (n == 0) return 1;
  long long r = n * fact(n - 1);
  r %= MM;
  return r;
}
unsigned long long Combinations(unsigned long long n, unsigned long long r) {
  if (r > n) return 0;
  if (r * 2 > n) r = n - r;
  if (r == 0) return 1;
  unsigned long long res = n;
  for (int i = 2; i <= r; ++i) {
    res *= (n - i + 1);
    res /= i;
  }
  return res;
}
long long pow(long long a, long long b, long long m = MM) {
  if (b == 0) return 1;
  if (b == 1) return a;
  long long x = pow(a, b / 2, m);
  x = (x * x) % m;
  if (b % 2) x = (x * a);
  return x % m;
}
int dd(string s) {
  long long res = 0;
  for (int i = 0; i < s.size(); i++) {
    res *= 2;
    res += s[i] - 48;
  }
  return res;
}
int solve() {
  int n, k, d;
  cin >> n >> k >> d;
  vector<vector<long long>> v = {{n}};
  vector<long long> vv;
  int f = 1;
  int l = 0;
  if (k == 1 && n > 1) return cout << -1, 0;
  if (k >= n) {
    while (d--) {
      for (int i = 1; i <= n; i++) {
        cout << i << " ";
      }
      cout << "\n";
    }
    return 0;
  }
  while (f) {
    f = 0;
    v.emplace_back(vv);
    for (int i = 0; i < v[l].size(); i++) {
      if (v[l][i] == 1) {
        v.back().emplace_back(1);
        continue;
      }
      int r = v[l][i] % k;
      for (int j = 0; j < k; j++) {
        v.back().emplace_back(v[l][i] / k);
        if (r) {
          v.back().back()++;
          r--;
        }
        if (v.back().back() > 1) f = 1;
      }
    }
    l++;
  }
  if (v.size() - 1 > d) return cout << -1, 0;
  for (int i = 1, n = 1; n <= d; n++) {
    for (int j = 0; j < v[i].size(); j++) {
      for (int m = 0; m < v[i][j]; m++) {
        if (j % k == 0) {
          cout << k << " ";
        } else {
          cout << j % k << " ";
        }
      }
    }
    cout << "\n";
    if (i + 1 < v.size()) i++;
  }
  return 0;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) {
    solve();
  }
}