class Graph:
def init(self):
self.dic = {}
self.vis = [0] * 100001
self.timer = 1
self.tin = [0] * 100001
self.low = [0] * 100001
self.ap = set()

def add_edge(self, a, b):
    if a in self.dic:
        self.dic[a].append(b)
    else:
        self.dic[a] = [b]
    if b in self.dic:
        self.dic[b].append(a)
    else:
        self.dic[b] = [a]

def dfs(self, node, par):
    self.vis[node] = 1
    self.low[node] = self.timer
    self.tin[node] = self.timer
    self.timer += 1
    cc = 0
    for child in self.dic[node]:
        if child == par:
            continue
        elif self.vis[child] == 1:
            self.low[node] = min(self.low[node], self.tin[child])
        else:
            self.dfs(child, node)
            cc += 1
            self.low[node] = min(self.low[node], self.low[child])
            if self.tin[node] <= self.low[child] and par != -1:
                self.ap.add(node)
                # print(node)
        # print(self.low[:10])
    if par == -1 and cc > 1:
        self.ap.add(node)
        # print(node)

while True:
g = Graph()
n = 0
m = 0
try:
n, m = map(int, input().split())
except:
pass
if n == 0 and m == 0:
break
for i in range(m):
a = 0
b = 0
a, b = map(int, input().split())
g.add_edge(a, b)
for i in range(1, n + 1):
if g.vis[i] != 1:
g.dfs(i, -1)
print(len(g.ap))

I am getting Runtime error(NZEC). Can anyone help?