from centroids, find the medoid respectively