

from collections import deque
from math import floor
from random import random
from time import time



class        _a		:


					'''simple docstring'''






					def __init__(					self     ):
						A__				:       Optional[int]	  =						{}






					def     __A     (					self       ,			A__       ,			A__       ,			A__=1     ):
						if self.graph.get(A__     ):
							if self.graph[u].count([w, v]     ) == 0:
								self.graph[u].append([w, v]     )
						else:
							A__				:       Tuple	  =						[[w, v]]
						if not self.graph.get(A__     ):
							A__				:       int	  =						[]






					def     __A     (					self     ):
						return list(self.graph     )






					def     __A     (					self       ,			A__       ,			A__     ):
						if self.graph.get(A__     ):
							for _ in self.graph[u]:
								if _[1] == v:
									self.graph[u].remove(A__     )






					def     __A     (					self       ,			A__=-2       ,			A__=-1     ):
						if s == d:
							return []
						A__				:       Union[str, Any]	  =						[]
						A__				:       List[str]	  =						[]
						if s == -2:
							A__				:       Optional[int]	  =						list(self.graph     )[0]
						stack.append(A__     )
						visited.append(A__     )
						A__				:       Tuple	  =						s

						while True:
							# check if there is any non isolated nodes
							if len(self.graph[s]     ) != 0:
								A__				:       Any	  =						s
								for node in self.graph[s]:
									if visited.count(node[1]     ) < 1:
										if node[1] == d:
											visited.append(A__     )
											return visited
										else:
											stack.append(node[1]     )
											visited.append(node[1]     )
											A__				:       Optional[Any]	  =						node[1]
											break

            # check if all the children are visited
							if s == ss:
								stack.pop()
								if len(A__     ) != 0:
									A__				:       Tuple	  =						stack[len(A__     ) - 1]
							else:
								A__				:       Tuple	  =						ss

							# check if se have reached the starting point
							if len(A__     ) == 0:
								return visited






					def     __A     (					self       ,			A__=-1     ):
						if c == -1:
							A__				:       int	  =						floor(random() * 1_0000     ) + 10
						for i in range(A__     ):
							# every vertex has max 100 edges
							for _ in range(floor(random() * 102     ) + 1     ):
								A__				:       Union[str, Any]	  =						floor(random() * c     ) + 1
								if n != i:
									self.add_pair(A__       ,			A__       ,			1     )






					def     __A     (					self       ,			A__=-2     ):
						A__				:       str	  =						deque()
						A__				:       List[str]	  =						[]
						if s == -2:
							A__				:       Optional[Any]	  =						list(self.graph     )[0]
						d.append(A__     )
						visited.append(A__     )
						while d:
							A__				:       Optional[Any]	  =						d.popleft()
							if len(self.graph[s]     ) != 0:
								for node in self.graph[s]:
									if visited.count(node[1]     ) < 1:
										d.append(node[1]     )
										visited.append(node[1]     )
						return visited






					def     __A     (					self       ,			A__     ):
						A__				:       Any	  =						0
						for x in self.graph:
							for y in self.graph[x]:
								if y[1] == u:
									count += 1
						return count






					def     __A     (					self       ,			A__     ):
						return len(self.graph[u]     )






					def     __A     (					self       ,			A__=-2     ):
						A__				:       Dict	  =						[]
						A__				:       Dict	  =						[]
						if s == -2:
							A__				:       List[Any]	  =						list(self.graph     )[0]
						stack.append(A__     )
						visited.append(A__     )
						A__				:       Optional[Any]	  =						s
						A__				:       Any	  =						[]

						while True:
							# check if there is any non isolated nodes
							if len(self.graph[s]     ) != 0:
								A__				:       str	  =						s
								for node in self.graph[s]:
									if visited.count(node[1]     ) < 1:
										stack.append(node[1]     )
										visited.append(node[1]     )
										A__				:       Any	  =						node[1]
										break

            # check if all the children are visited
							if s == ss:
								sorted_nodes.append(stack.pop()     )
								if len(A__     ) != 0:
									A__				:       List[str]	  =						stack[len(A__     ) - 1]
							else:
								A__				:       int	  =						ss

							# check if se have reached the starting point
							if len(A__     ) == 0:
								return sorted_nodes






					def     __A     (					self     ):
						A__				:       Union[str, Any]	  =						[]
						A__				:       str	  =						[]
						A__				:       Union[str, Any]	  =						list(self.graph     )[0]
						stack.append(A__     )
						visited.append(A__     )
						A__				:       Union[str, Any]	  =						-2
						A__				:       str	  =						[]
						A__				:       Optional[Any]	  =						s
						A__				:       Optional[int]	  =						False
						A__				:       int	  =						set()

						while True:
							# check if there is any non isolated nodes
							if len(self.graph[s]     ) != 0:
								A__				:       int	  =						s
								for node in self.graph[s]:
									if (
									    visited.count(node[1]     ) > 0
									    and node[1] != parent
									    and indirect_parents.count(node[1]     ) > 0
									    and not on_the_way_back
									):
										A__				:       Any	  =						len(A__     ) - 1
										while len_stack >= 0:
											if stack[len_stack] == node[1]:
												anticipating_nodes.add(node[1]     )
												break
											else:
												anticipating_nodes.add(stack[len_stack]     )
												len_stack -= 1
									if visited.count(node[1]     ) < 1:
										stack.append(node[1]     )
										visited.append(node[1]     )
										A__				:       List[str]	  =						node[1]
										break

            # check if all the children are visited
							if s == ss:
								stack.pop()
								A__				:       Union[str, Any]	  =						True
								if len(A__     ) != 0:
									A__				:       Union[str, Any]	  =						stack[len(A__     ) - 1]
							else:
								A__				:       Dict	  =						False
								indirect_parents.append(A__     )
								A__				:       Union[str, Any]	  =						s
								A__				:       List[Any]	  =						ss

							# check if se have reached the starting point
							if len(A__     ) == 0:
								return list(A__     )






					def     __A     (					self     ):
						A__				:       Tuple	  =						[]
						A__				:       str	  =						[]
						A__				:       Tuple	  =						list(self.graph     )[0]
						stack.append(A__     )
						visited.append(A__     )
						A__				:       Optional[int]	  =						-2
						A__				:       List[str]	  =						[]
						A__				:       List[str]	  =						s
						A__				:       Tuple	  =						False
						A__				:       str	  =						set()

						while True:
							# check if there is any non isolated nodes
							if len(self.graph[s]     ) != 0:
								A__				:       List[Any]	  =						s
								for node in self.graph[s]:
									if (
									    visited.count(node[1]     ) > 0
									    and node[1] != parent
									    and indirect_parents.count(node[1]     ) > 0
									    and not on_the_way_back
									):
										A__				:       Union[str, Any]	  =						len(A__     ) - 1
										while len_stack_minus_one >= 0:
											if stack[len_stack_minus_one] == node[1]:
												anticipating_nodes.add(node[1]     )
												break
											else:
												return True
									if visited.count(node[1]     ) < 1:
										stack.append(node[1]     )
										visited.append(node[1]     )
										A__				:       Tuple	  =						node[1]
										break

            # check if all the children are visited
							if s == ss:
								stack.pop()
								A__				:       Optional[Any]	  =						True
								if len(A__     ) != 0:
									A__				:       Dict	  =						stack[len(A__     ) - 1]
							else:
								A__				:       List[Any]	  =						False
								indirect_parents.append(A__     )
								A__				:       Union[str, Any]	  =						s
								A__				:       Any	  =						ss

							# check if se have reached the starting point
							if len(A__     ) == 0:
								return False






					def     __A     (					self       ,			A__=-2       ,			A__=-1     ):
						A__				:       List[Any]	  =						time()
						self.dfs(A__       ,			A__     )
						A__				:       List[Any]	  =						time()
						return end - begin






					def     __A     (					self       ,			A__=-2     ):
						A__				:       str	  =						time()
						self.bfs(A__     )
						A__				:       Optional[Any]	  =						time()
						return end - begin



class        _a		:


					'''simple docstring'''






					def __init__(					self     ):
						A__				:       int	  =						{}






					def     __A     (					self       ,			A__       ,			A__       ,			A__=1     ):
						# check if the u exists
						if self.graph.get(A__     ):
							# if there already is a edge
							if self.graph[u].count([w, v]     ) == 0:
								self.graph[u].append([w, v]     )
						else:
							# if u does not exist
							A__				:       str	  =						[[w, v]]
						# add the other way
						if self.graph.get(A__     ):
							# if there already is a edge
							if self.graph[v].count([w, u]     ) == 0:
								self.graph[v].append([w, u]     )
						else:
							# if u does not exist
							A__				:       List[str]	  =						[[w, u]]






					def     __A     (					self       ,			A__       ,			A__     ):
						if self.graph.get(A__     ):
							for _ in self.graph[u]:
								if _[1] == v:
									self.graph[u].remove(A__     )
        # the other way round
						if self.graph.get(A__     ):
							for _ in self.graph[v]:
								if _[1] == u:
									self.graph[v].remove(A__     )






					def     __A     (					self       ,			A__=-2       ,			A__=-1     ):
						if s == d:
							return []
						A__				:       List[Any]	  =						[]
						A__				:       Optional[Any]	  =						[]
						if s == -2:
							A__				:       int	  =						list(self.graph     )[0]
						stack.append(A__     )
						visited.append(A__     )
						A__				:       Any	  =						s

						while True:
							# check if there is any non isolated nodes
							if len(self.graph[s]     ) != 0:
								A__				:       Optional[Any]	  =						s
								for node in self.graph[s]:
									if visited.count(node[1]     ) < 1:
										if node[1] == d:
											visited.append(A__     )
											return visited
										else:
											stack.append(node[1]     )
											visited.append(node[1]     )
											A__				:       Dict	  =						node[1]
											break

            # check if all the children are visited
							if s == ss:
								stack.pop()
								if len(A__     ) != 0:
									A__				:       str	  =						stack[len(A__     ) - 1]
							else:
								A__				:       str	  =						ss

							# check if se have reached the starting point
							if len(A__     ) == 0:
								return visited






					def     __A     (					self       ,			A__=-1     ):
						if c == -1:
							A__				:       List[Any]	  =						floor(random() * 1_0000     ) + 10
						for i in range(A__     ):
							# every vertex has max 100 edges
							for _ in range(floor(random() * 102     ) + 1     ):
								A__				:       int	  =						floor(random() * c     ) + 1
								if n != i:
									self.add_pair(A__       ,			A__       ,			1     )






					def     __A     (					self       ,			A__=-2     ):
						A__				:       str	  =						deque()
						A__				:       str	  =						[]
						if s == -2:
							A__				:       List[Any]	  =						list(self.graph     )[0]
						d.append(A__     )
						visited.append(A__     )
						while d:
							A__				:       List[str]	  =						d.popleft()
							if len(self.graph[s]     ) != 0:
								for node in self.graph[s]:
									if visited.count(node[1]     ) < 1:
										d.append(node[1]     )
										visited.append(node[1]     )
						return visited






					def     __A     (					self       ,			A__     ):
						return len(self.graph[u]     )






					def     __A     (					self     ):
						A__				:       Optional[int]	  =						[]
						A__				:       Optional[int]	  =						[]
						A__				:       Union[str, Any]	  =						list(self.graph     )[0]
						stack.append(A__     )
						visited.append(A__     )
						A__				:       int	  =						-2
						A__				:       Tuple	  =						[]
						A__				:       Tuple	  =						s
						A__				:       Union[str, Any]	  =						False
						A__				:       Union[str, Any]	  =						set()

						while True:
							# check if there is any non isolated nodes
							if len(self.graph[s]     ) != 0:
								A__				:       Tuple	  =						s
								for node in self.graph[s]:
									if (
									    visited.count(node[1]     ) > 0
									    and node[1] != parent
									    and indirect_parents.count(node[1]     ) > 0
									    and not on_the_way_back
									):
										A__				:       int	  =						len(A__     ) - 1
										while len_stack >= 0:
											if stack[len_stack] == node[1]:
												anticipating_nodes.add(node[1]     )
												break
											else:
												anticipating_nodes.add(stack[len_stack]     )
												len_stack -= 1
									if visited.count(node[1]     ) < 1:
										stack.append(node[1]     )
										visited.append(node[1]     )
										A__				:       Tuple	  =						node[1]
										break

            # check if all the children are visited
							if s == ss:
								stack.pop()
								A__				:       Tuple	  =						True
								if len(A__     ) != 0:
									A__				:       Optional[Any]	  =						stack[len(A__     ) - 1]
							else:
								A__				:       int	  =						False
								indirect_parents.append(A__     )
								A__				:       Dict	  =						s
								A__				:       int	  =						ss

							# check if se have reached the starting point
							if len(A__     ) == 0:
								return list(A__     )






					def     __A     (					self     ):
						A__				:       str	  =						[]
						A__				:       Optional[Any]	  =						[]
						A__				:       Dict	  =						list(self.graph     )[0]
						stack.append(A__     )
						visited.append(A__     )
						A__				:       List[Any]	  =						-2
						A__				:       List[Any]	  =						[]
						A__				:       Optional[Any]	  =						s
						A__				:       Optional[int]	  =						False
						A__				:       Any	  =						set()

						while True:
							# check if there is any non isolated nodes
							if len(self.graph[s]     ) != 0:
								A__				:       Optional[Any]	  =						s
								for node in self.graph[s]:
									if (
									    visited.count(node[1]     ) > 0
									    and node[1] != parent
									    and indirect_parents.count(node[1]     ) > 0
									    and not on_the_way_back
									):
										A__				:       Any	  =						len(A__     ) - 1
										while len_stack_minus_one >= 0:
											if stack[len_stack_minus_one] == node[1]:
												anticipating_nodes.add(node[1]     )
												break
											else:
												return True
									if visited.count(node[1]     ) < 1:
										stack.append(node[1]     )
										visited.append(node[1]     )
										A__				:       str	  =						node[1]
										break

            # check if all the children are visited
							if s == ss:
								stack.pop()
								A__				:       Optional[Any]	  =						True
								if len(A__     ) != 0:
									A__				:       Any	  =						stack[len(A__     ) - 1]
							else:
								A__				:       Tuple	  =						False
								indirect_parents.append(A__     )
								A__				:       int	  =						s
								A__				:       Tuple	  =						ss

							# check if se have reached the starting point
							if len(A__     ) == 0:
								return False






					def     __A     (					self     ):
						return list(self.graph     )






					def     __A     (					self       ,			A__=-2       ,			A__=-1     ):
						A__				:       Tuple	  =						time()
						self.dfs(A__       ,			A__     )
						A__				:       Tuple	  =						time()
						return end - begin






					def     __A     (					self       ,			A__=-2     ):
						A__				:       int	  =						time()
						self.bfs(A__     )
						A__				:       int	  =						time()
						return end - begin






from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available


A_			:					Tuple    			=     {
    'configuration_xlm': ['XLM_PRETRAINED_CONFIG_ARCHIVE_MAP', 'XLMConfig', 'XLMOnnxConfig'],
    'tokenization_xlm': ['XLMTokenizer'],
}

try:
	if not is_torch_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	A_			:					Dict    			=     [
	    'XLM_PRETRAINED_MODEL_ARCHIVE_LIST',
	    'XLMForMultipleChoice',
	    'XLMForQuestionAnswering',
	    'XLMForQuestionAnsweringSimple',
	    'XLMForSequenceClassification',
	    'XLMForTokenClassification',
	    'XLMModel',
	    'XLMPreTrainedModel',
	    'XLMWithLMHeadModel',
	]

try:
	if not is_tf_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	A_			:					str    			=     [
	    'TF_XLM_PRETRAINED_MODEL_ARCHIVE_LIST',
	    'TFXLMForMultipleChoice',
	    'TFXLMForQuestionAnsweringSimple',
	    'TFXLMForSequenceClassification',
	    'TFXLMForTokenClassification',
	    'TFXLMMainLayer',
	    'TFXLMModel',
	    'TFXLMPreTrainedModel',
	    'TFXLMWithLMHeadModel',
	]


if TYPE_CHECKING:
	from .configuration_xlm import XLM_PRETRAINED_CONFIG_ARCHIVE_MAP, XLMConfig, XLMOnnxConfig
	from .tokenization_xlm import XLMTokenizer

	try:
		if not is_torch_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .modeling_xlm import (
		    XLM_PRETRAINED_MODEL_ARCHIVE_LIST,
		    XLMForMultipleChoice,
		    XLMForQuestionAnswering,
		    XLMForQuestionAnsweringSimple,
		    XLMForSequenceClassification,
		    XLMForTokenClassification,
		    XLMModel,
		    XLMPreTrainedModel,
		    XLMWithLMHeadModel,
		)

	try:
		if not is_tf_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .modeling_tf_xlm import (
		    TF_XLM_PRETRAINED_MODEL_ARCHIVE_LIST,
		    TFXLMForMultipleChoice,
		    TFXLMForQuestionAnsweringSimple,
		    TFXLMForSequenceClassification,
		    TFXLMForTokenClassification,
		    TFXLMMainLayer,
		    TFXLMModel,
		    TFXLMPreTrainedModel,
		    TFXLMWithLMHeadModel,
		)

else:
	import sys

	A_			:					Tuple    			=     _LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)



