Fixed a bug in problem 1 of tree