





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







class     __snake_case       :





       '''simple docstring'''







       def __init__(  self :    Optional[Any]		):
         __snake_case:						List[str]   =						{}




       def 							UpperCAmelCase__ (  self :    str							,				A :    int							,				A :    Tuple							,				A :    List[Any]=1		):
         if self.graph.get(A		):
           if self.graph[u].count([w, v]		) == 0:
             self.graph[u].append([w, v]		)
         else:
           __snake_case:						Dict   =						[[w, v]]
         if not self.graph.get(A		):
           __snake_case:						Optional[int]   =						[]




       def 							UpperCAmelCase__ (  self :    List[Any]		):
         return list(self.graph		)




       def 							UpperCAmelCase__ (  self :    List[str]							,				A :    int							,				A :    Union[str, Any]		):
         if self.graph.get(A		):
           for _ in self.graph[u]:
             if _[1] == v:
               self.graph[u].remove(A		)




       def 							UpperCAmelCase__ (  self :    List[Any]							,				A :    Optional[int]=-2							,				A :    List[Any]=-1		):
         if s == d:
           return []
         __snake_case:						List[str]   =						[]
         __snake_case:						Dict   =						[]
         if s == -2:
           __snake_case:						int   =						list(self.graph		)[0]
         stack.append(A		)
         visited.append(A		)
         __snake_case:						List[str]   =						s

         while True:
           # check if there is any non isolated nodes
           if len(self.graph[s]		) != 0:
             __snake_case:						Optional[int]   =						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]		)
                   __snake_case:						int   =						node[1]
                   break

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

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




       def 							UpperCAmelCase__ (  self :    Optional[Any]							,				A :    str=-1		):
         if c == -1:
           __snake_case:						Tuple   =						floor(random() * 10_000		) + 10
         for i in range(A		):
           # every vertex has max 100 edges
           for _ in range(floor(random() * 102		) + 1		):
             __snake_case:						List[str]   =						floor(random() * c		) + 1
             if n != i:
               self.add_pair(A							,				A							,				1		)




       def 							UpperCAmelCase__ (  self :    Union[str, Any]							,				A :    List[str]=-2		):
         __snake_case:						Optional[int]   =						deque()
         __snake_case:						Any   =						[]
         if s == -2:
           __snake_case:						Any   =						list(self.graph		)[0]
         d.append(A		)
         visited.append(A		)
         while d:
           __snake_case:						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 							UpperCAmelCase__ (  self :    Optional[Any]							,				A :    Tuple		):
         __snake_case:						Union[str, Any]   =						0
         for x in self.graph:
           for y in self.graph[x]:
             if y[1] == u:
               count += 1
         return count




       def 							UpperCAmelCase__ (  self :    List[Any]							,				A :    Optional[Any]		):
         return len(self.graph[u]		)




       def 							UpperCAmelCase__ (  self :    Optional[int]							,				A :    List[Any]=-2		):
         __snake_case:						Any   =						[]
         __snake_case:						List[str]   =						[]
         if s == -2:
           __snake_case:						str   =						list(self.graph		)[0]
         stack.append(A		)
         visited.append(A		)
         __snake_case:						Any   =						s
         __snake_case:						Any   =						[]

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

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

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




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

         while True:
           # check if there is any non isolated nodes
           if len(self.graph[s]		) != 0:
             __snake_case:						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
               ):
                 __snake_case:						Dict   =						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]		)
                 __snake_case:						Optional[int]   =						node[1]
                 break

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

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




       def 							UpperCAmelCase__ (  self :    str		):
         __snake_case:						Optional[Any]   =						[]
         __snake_case:						Optional[Any]   =						[]
         __snake_case:						Any   =						list(self.graph		)[0]
         stack.append(A		)
         visited.append(A		)
         __snake_case:						Tuple   =						-2
         __snake_case:						Any   =						[]
         __snake_case:						Tuple   =						s
         __snake_case:						int   =						False
         __snake_case:						Optional[int]   =						set()

         while True:
           # check if there is any non isolated nodes
           if len(self.graph[s]		) != 0:
             __snake_case:						List[str]   =						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
               ):
                 __snake_case:						Optional[int]   =						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]		)
                 __snake_case:						Optional[int]   =						node[1]
                 break

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

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




       def 							UpperCAmelCase__ (  self :    List[Any]							,				A :    List[str]=-2							,				A :    Optional[int]=-1		):
         __snake_case:						Tuple   =						time()
         self.dfs(A							,				A		)
         __snake_case:						int   =						time()
         return end - begin






       def 							UpperCAmelCase__ (  self :    Any							,				A :    Tuple=-2		):
         __snake_case:						str   =						time()
         self.bfs(A		)
         __snake_case:						Optional[int]   =						time()
         return end - begin







class     __snake_case       :





       '''simple docstring'''







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




       def 							UpperCAmelCase__ (  self :    Optional[int]							,				A :    int							,				A :    Union[str, Any]							,				A :    Any=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
           __snake_case:						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
           __snake_case:						Optional[Any]   =						[[w, u]]




       def 							UpperCAmelCase__ (  self :    Union[str, Any]							,				A :    str							,				A :    str		):
         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 							UpperCAmelCase__ (  self :    Union[str, Any]							,				A :    Tuple=-2							,				A :    int=-1		):
         if s == d:
           return []
         __snake_case:						Optional[int]   =						[]
         __snake_case:						int   =						[]
         if s == -2:
           __snake_case:						Dict   =						list(self.graph		)[0]
         stack.append(A		)
         visited.append(A		)
         __snake_case:						Optional[Any]   =						s

         while True:
           # check if there is any non isolated nodes
           if len(self.graph[s]		) != 0:
             __snake_case:						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]		)
                   __snake_case:						Optional[int]   =						node[1]
                   break

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

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




       def 							UpperCAmelCase__ (  self :    Optional[Any]							,				A :    str=-1		):
         if c == -1:
           __snake_case:						Tuple   =						floor(random() * 10_000		) + 10
         for i in range(A		):
           # every vertex has max 100 edges
           for _ in range(floor(random() * 102		) + 1		):
             __snake_case:						Tuple   =						floor(random() * c		) + 1
             if n != i:
               self.add_pair(A							,				A							,				1		)




       def 							UpperCAmelCase__ (  self :    Optional[int]							,				A :    Tuple=-2		):
         __snake_case:						Union[str, Any]   =						deque()
         __snake_case:						Tuple   =						[]
         if s == -2:
           __snake_case:						Tuple   =						list(self.graph		)[0]
         d.append(A		)
         visited.append(A		)
         while d:
           __snake_case:						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 							UpperCAmelCase__ (  self :    Union[str, Any]							,				A :    Optional[int]		):
         return len(self.graph[u]		)




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

         while True:
           # check if there is any non isolated nodes
           if len(self.graph[s]		) != 0:
             __snake_case:						Dict   =						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
               ):
                 __snake_case:						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]		)
                 __snake_case:						str   =						node[1]
                 break

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

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




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

         while True:
           # check if there is any non isolated nodes
           if len(self.graph[s]		) != 0:
             __snake_case:						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
               ):
                 __snake_case:						Optional[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]		)
                 __snake_case:						Union[str, Any]   =						node[1]
                 break

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

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




       def 							UpperCAmelCase__ (  self :    Any		):
         return list(self.graph		)




       def 							UpperCAmelCase__ (  self :    Union[str, Any]							,				A :    Union[str, Any]=-2							,				A :    List[str]=-1		):
         __snake_case:						List[Any]   =						time()
         self.dfs(A							,				A		)
         __snake_case:						Optional[int]   =						time()
         return end - begin






       def 							UpperCAmelCase__ (  self :    List[Any]							,				A :    Union[str, Any]=-2		):
         __snake_case:						int   =						time()
         self.bfs(A		)
         __snake_case:						Dict   =						time()
         return end - begin













__UpperCAmelCase       :   int				       =							[
    "Audio",
    "Array2D",
    "Array3D",
    "Array4D",
    "Array5D",
    "ClassLabel",
    "Features",
    "Sequence",
    "Value",
    "Image",
    "Translation",
    "TranslationVariableLanguages",
]
from .audio import Audio
from .features import ArrayaD, ArrayaD, ArrayaD, ArrayaD, ClassLabel, Features, Sequence, Value
from .image import Image
from .translation import Translation, TranslationVariableLanguages






