{ nb = vector(2^7-1, n, 3^hammingweight(n)); T = vector(#nb, n, vector(nb[n])); occ = vector(#nb); u = 1; print ("0 0"); i = 0; j = 0; for (d = 1, oo, for (k = 0, d, v = bitor(d-k, k); i++; if (v <= #T, T[v][occ[v]++] = i; while (occ[u]==nb[u], apply (t -> print (j++ " " t), T[u]); if (u++ > #T, break (3); ); ); ); ); ); } quit