recursive tree select