BST simplified IdentifyingWood from TopCoder 635.