https://jacoby.github.io/2023/12/11/partidges-and-pair-trees-weekly-challenge-247.html