diff --git a/buggy.py b/buggy.py
--- a/buggy.py
+++ b/buggy.py
@@ -110,7 +110,7 @@
 
 for i in range(n):
     for j in range(n):
-        if isPrime(li[i][0] + li[j][1]):
+        if isPrime(li[i][0] + li[j][0]):
             mf.add_edge(i + 1, j + n + 1, inf)
 
 print(mf.flow(start, end) // 2)
