diff --git a/buggy.py b/buggy.py
--- a/buggy.py
+++ b/buggy.py
@@ -15,7 +15,7 @@
     dd = [-1] * (n1 + n2)
     dd[s] = 0
     q = deque()
-    q.append(0)
+    q.append(s)
     while q:
         now = q.popleft()
         for b in g[now]:
