. . "here is a solution I would propose using Rank Trees. (The link does not add much to the conversation other than to point out I didn't come up with the notion." . .