solved tree problem