Buggy python submission (verdict: Runtime Error):
class node:
    def __init__(self, num):
        self.number     = num
        self.group      = 0
        self.link_node  = []
        self.is_serched = False

def DFS(node, group_num):
    node.is_serched = True
    node.group      = group_num
    for item in node.link_node:
        if item.is_serched == False:
            DFS(item, group_num)

n ,m = map(int, raw_input().split())
node_list = [None] * (n)

for i in xrange(n):
    node_list[i] = node(i)

for _ in xrange(m):
    s, t = map(int, raw_input().split())
    node_list[s].link_node.append(node_list[t])
    node_list[t].link_node.append(node_list[s])

group_num = 1
for item in node_list:
    if item.is_serched == False:
        DFS(item, group_num)
        group_num = group_num + 1

q = input()
for _ in xrange(q):
    s, t = map(int, raw_input().split())
    if node_list[s].group == node_list[t].group:
        print 'yes'
    else:
        print 'no'  

Fixed submission:
Group = [None] * 100001
Edge  = [None] * 100001

def DFS(item, group):
    S = []
    S.append(item)
    Group[item] = group
    while (len(S) != 0):
        S_top = S.pop()
        for link in Edge[S_top]:
            if Group[link] == 0:
                Group[link] = group
                S.append(link)

n, m = map(int, raw_input().split())
for i in xrange(n):
    Edge[i] = []
    Group[i] = 0

for i in xrange(m):
    s, t = map(int, raw_input().split())
    Edge[s].append(t)
    Edge[t].append(s)

group = 1
for i in xrange(n):
    if Group[i] == 0:
        DFS(i, group)
        group = group + 1

q = input()
for _ in xrange(q):
    s, t = map(int, raw_input().split())
    if Group[s] == Group[t]:
        print 'yes'
    else:
        print 'no'

Buggy python submission (verdict: Runtime Error):
class node:
    def __init__(self, num):
        self.number     = num
        self.group      = 0
        self.link_node  = []
        self.is_serched = False

def DFS(node, group_num):
    node.is_serched = True
    node.group      = group_num
    for item in node.link_node:
        if item.is_serched == False:
            DFS(item, group_num)

n ,m = map(int, raw_input().split())
node_list = [None] * (n)

for i in xrange(n):
    node_list[i] = node(i)

for _ in xrange(m):
    s, t = map(int, raw_input().split())
    node_list[s].link_node.append(node_list[t])
    node_list[t].link_node.append(node_list[s])

group_num = 1
for item in node_list:
    if item.is_serched == False:
        DFS(item, group_num)
        group_num = group_num + 1

q = input()
for _ in xrange(q):
    s, t = map(int, raw_input().split())
    if node_list[s].group == node_list[t].group:
        print 'yes'
    else:
        print 'no'  

Fixed submission:
Group = [None] * 100001
Edge  = [None] * 100001

def DFS(item, group):
    S = []
    S.append(item)
    Group[item] = group
    while (len(S) != 0):
        S_top = S.pop()
        for link in Edge[S_top]:
            if Group[link] == 0:
                Group[link] = group
                S.append(link)

n, m = map(int, raw_input().split())
for i in xrange(n):
    Edge[i] = []
    Group[i] = 0

for i in xrange(m):
    s, t = map(int, raw_input().split())
    Edge[s].append(t)
    Edge[t].append(s)

group = 1
for i in xrange(n):
    if Group[i] == 0:
        DFS(i, group)
        group = group + 1

q = input()
for _ in xrange(q):
    s, t = map(int, raw_input().split())
    if Group[s] == Group[t]:
        print 'yes'
    else:
        print 'no'

Buggy python submission (verdict: Runtime Error):
class node:
    def __init__(self, num):
        self.number     = num
        self.group      = 0
        self.link_node  = []
        self.is_serched = False

def DFS(node, group_num):
    node.is_serched = True
    node.group      = group_num
    for item in node.link_node:
        if item.is_serched == False:
            DFS(item, group_num)

n ,m = map(int, raw_input().split())
node_list = [None] * (n)

for i in xrange(n):
    node_list[i] = node(i)

for _ in xrange(m):
    s, t = map(int, raw_input().split())
    node_list[s].link_node.append(node_list[t])
    node_list[t].link_node.append(node_list[s])

group_num = 1
for item in node_list:
    if item.is_serched == False:
        DFS(item, group_num)
        group_num = group_num + 1

q = input()
for _ in xrange(q):
    s, t = map(int, raw_input().split())
    if node_list[s].group == node_list[t].group:
        print 'yes'
    else:
        print 'no'  

Fixed submission:
Group = [None] * 100001
Edge  = [None] * 100001

def DFS(item, group):
    S = []
    S.append(item)
    Group[item] = group
    while (len(S) != 0):
        S_top = S.pop()
        for link in Edge[S_top]:
            if Group[link] == 0:
                Group[link] = group
                S.append(link)

n, m = map(int, raw_input().split())
for i in xrange(n):
    Edge[i] = []
    Group[i] = 0

for i in xrange(m):
    s, t = map(int, raw_input().split())
    Edge[s].append(t)
    Edge[t].append(s)

group = 1
for i in xrange(n):
    if Group[i] == 0:
        DFS(i, group)
        group = group + 1

q = input()
for _ in xrange(q):
    s, t = map(int, raw_input().split())
    if Group[s] == Group[t]:
        print 'yes'
    else:
        print 'no'