code for find the centroids from medoids