Pairwise clustering using a Monte Carlo Markov Chain