tree traversal utils; tree reconstruction