This paper proposes a variation of least-to-most prompting where the decompositions can form a tree, and different prompt examples are fetched dynamically from a training pool when solving each of the sub-problems. They focus on benchmarks that test compositional generalization in semantic parsing, experimental gains over flat least-to-most prompting.