diff --git a/buggy.py b/buggy.py
--- a/buggy.py
+++ b/buggy.py
@@ -9,7 +9,7 @@
 
 c.sort()
 for i in range(n + m - 1):
-    if c[i][1] == c[i + 1][1]:
+    if c[i][1] == 1 and c[i + 1][1] == 1:
         print("Yes")
         exit()
 print("No")
