This program is not guaranteed to terminate for all input values. It may take a very long time to produce trees with large widths and low thresholds.