linear select (to be continued)
element pair with the smallest distance