Closest points problem