diff --git a/buggy.py b/buggy.py
--- a/buggy.py
+++ b/buggy.py
@@ -7,6 +7,6 @@
     k, d = 0, 0
     for j in range(1, N + 1):
         dn = (X[i] - X[j]) ** 2 + (Y[i] - Y[j]) ** 2
-        if dn < d:
+        if dn > d:
             k, d = j, dn
     print(k)
