diff --git a/buggy.py b/buggy.py
--- a/buggy.py
+++ b/buggy.py
@@ -13,7 +13,7 @@
 
     for i in range(N):
         for j in range(M):
-            if B[i][j] % 7 > j + 1:
+            if B[i][j] % 7 == 0 and j != M - 1:
                 print("No")
                 return
 
