no more than two in sets[0:D-1] would be non-empty