brute-force closest distance