Implement new pivot selector for better tree balancing. Create prompt for queries. Separate distance assigning from builder because it is reused by CornerPivotSelector.