diff --git a/buggy.py b/buggy.py
--- a/buggy.py
+++ b/buggy.py
@@ -2,7 +2,7 @@
 s = [0 for _ in range(n)]
 p = {}
 p[0] = n
-for i in range(n):
+for i in range(t):
     a, b = map(int, input().split())
     a -= 1
     p[s[a]] -= 1
