Solution to tree