Function for performing DFS and answer to queries
def numberOfNodesUtil ( Q , M , N ) : NEW_LINE INDENT global t , adj NEW_LINE adj = Add_edge ( 1 , 2 , adj ) NEW_LINE adj = Add_edge ( 1 , 3 , adj ) NEW_LINE adj = Add_edge ( 2 , 4 , adj ) NEW_LINE adj = Add_edge ( 2 , 5 , adj ) NEW_LINE adj = Add_edge ( 2 , 6 , adj ) NEW_LINE t = 1 NEW_LINE DEDENT