Closest pair exercise