Tree programming exercise