import java.util.*; public class Betty2 { List<String> l; Set<String> s = new TreeSet<String>(); Betty2(int h) { l = new ArrayList<String>(h * (h-1) * (h-2)); for (int i = 1; i <= h; ++i) { for (int j = 1; j <= h; ++j) { if (i == j) continue; for (int k = 1; k <= h; ++k) { if (i == k || j == k) continue; l.add(i + "-" + j + "-" + k); } } } } void add(int r) {s.add(l.remove(r%l.size()));} public static void main(String[] args) { int h = Integer.parseInt(args[0]); int c = args.length < 2 ? 5 : Integer.parseInt(args[1]); if (h < 8 || 18 < h) throw new IllegalArgumentException("8-18"); if (c > h * (h-1) * (h-2)) throw new IllegalArgumentException("-_-"); Betty2 b = new Betty2(h); while (b.s.size() < c) b.add(r()); for (String s : b.s) System.out.println(s); } static int r() {return (int)(Math.random() * (Integer.MAX_VALUE-1)) + 1;} }