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 JAVA):

Solution:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.util.StringTokenizer;

/**
 * 459C
 *
 * @author artyom
 */
public class PashmakAndBuses3 implements Runnable {
    private BufferedReader in;
    private PrintStream out;
    private StringTokenizer tok;

    private StringBuilder sb;
    private int target;
    private int busesCount;

    private void solve() throws IOException {
        int students = nextInt();
        int k = nextInt(); // buses
        int d = nextInt(); // days
        int t = divCeil(students, (int) Math.pow(k, d));
        if (t > 1) {
            out.print("-1");
            return;
        }
        busesCount = Math.min(students, k);
        int count = 0;
        for (int m = k, i = 0; ; m *= k, i++) {
            target = divCeil(students, m);
            sb = new StringBuilder();
            populateBuses(students, 1);
            String x = sb.append('\n').toString().trim();
            out.println(x);
            count++;
            if (target == 1) {
                break;
            }
        }
        String s = sb.toString().trim();
        for (int i = 0, rem = d - count; i < rem; i++) {
            out.println(s);
        }
    }

    private void populateBuses(int students, int busIndex) {
        if (students <= target) {
            for (int i = 0; i < students; i++) {
                sb.append(busIndex).append(' ');
            }
        } else {
            int t = divCeil(students, busesCount);
            for (int i = 1, j = 0; i <= busesCount && j < students; i++, j += t) {
                populateBuses(Math.min(students - j, t), i);
            }
        }
    }

    private static int divCeil(int x, int y) {
        int res = x / y;
        if (x % y > 0) {
            ++res;
        }
        return res;
    }

    //--------------------------------------------------------------
    public static void main(String[] args) {
        new PashmakAndBuses3().run();
    }

    @Override
    public void run() {
        try {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = System.out;
            tok = null;
            solve();
            in.close();
        } catch (IOException e) {
            System.exit(0);
        }
    }

    private String nextToken() throws IOException {
        while (tok == null || !tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine());
        }
        return tok.nextToken();
    }

    private int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }
}