NN(nearest neighbor. chap 4 finished.)