import java.util.*;

public class Generate {
  public static void main(String[] args) {
    Random r = new Random();
    Scanner s = new Scanner(System.in);
    int n = s.nextInt(), k = s.nextInt(), l = s.nextInt();
    System.out.println(n + " " + k);
    for (int i = 0; i < n; i++) {
      int count = r.nextInt(l);
      System.out.print(count);
      Set<Integer> set = new HashSet<>();
      for (int j = 0; j < count; j++) {
        int villager = r.nextInt(n) + 1;
        while (set.contains(villager)) villager = r.nextInt(n) + 1;
        System.out.print(" " + villager);
        set.add(villager);
      }
      System.out.println();
    }
  }
}
