DP on the tree