closest pair advanced