I´m getting NZEC error in multiple submisions by changing a little bit the code below, the idea in general of the algorithm is checking if the Graph in bipartite or not by using BFS and bicoloring the nodes, I´ve already make google research trying to figure out the reasons of NZEC but i´m stuck, on my computer works fine

import sys
def make_link(G, n1, n2):
    if u not in G:
        G[n1] = []
    if v not in G:
        G[n2] = []
    G[n1].append(n2)
    G[n2].append(n1)
def bfs(G, root):
    q = [root]
    color = [-1] * (len(G.keys()) + 1)
    color[root] = 1
    while q:
        v = q.pop(0)
        for nb in G[v]:
            checked[nb] = 1
            if color[nb] == -1:
                color[nb] = 1 - color[v]
                q.append(nb)
            elif color[nb] == color[v]:
                return False
    return True
n = int(sys.stdin.readline())
for i in xrange(n):
    print 'Scenario #' + str(i + 1) + ':'
    G = {}
    b, c = map(int, sys.stdin.readline().split())
    checked=[0]*(b+1)
    for j in xrange(c):
        u, v = map(int, sys.stdin.readline().split())
        make_link(G, u, v)
    for k in xrange(b):
    if checked[k+1]==0:
        s=bfs(G,k+1)
        if s==False:
            print 'Suspicious bugs found!'
            break
if s==True:
    print 'No suspicious bugs found!'