generalized tree with arbitrary branching factor, and tree with value at each branch