What would you do in Knn specific case
When k=3 it is a simple case, the 3 nearest examples share the same distance to the new sample. Two of them are from class 1 and a single example is from class 2, so the new sample will be classified as class 1.

When k=2 it is more tricky. Assuming that the 2 features (x,y) share similar importance to the classification (otherwise distances should be calculated with some predetermined weights), you can:


Choose randomly 2 out of the 3 candidates (you are basically acknowledging that for this case, your model doesn't have enough information for classification based on 2-NN).
take all candidates into account (i.e. for cases like this you go to 3-NN).


When k=1, same options as with the k=2 case (you will still need to go up to 3-NN).

In this specific case, because your 3 nearest neighbors are all of the same distance, I would choose to use K-NN. However for a similar case with 4 samples at the same distance, 2 of each class, I would choose randomly (not going to 5-NN).