Solution for even tree problem.