classic tree travel problem