diff --git a/buggy.py b/buggy.py
--- a/buggy.py
+++ b/buggy.py
@@ -12,11 +12,10 @@
 dist = [-1 for i in range(N)]
 que = deque()
 for i in range(N):
-    if G[i] == 1:
+    if len(G[i]) == 1:
         dist[i] = 0
         que.append(i)
         break
-
 
 while que:
     v = que.popleft()
