Foundations of Comparison-Based Hierarchical Clustering