


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






class   _lowerCamelCase :




       """simple docstring"""



       def __init__(      self		)->Tuple:




         '''simple docstring'''





         A_      :				Any		     =					{}



       def        _snake_case       (      self				,       _SCREAMING_SNAKE_CASE				,       _SCREAMING_SNAKE_CASE				,       _SCREAMING_SNAKE_CASE=1		)->Optional[Any]:




         '''simple docstring'''





         if self.graph.get(SCREAMING_SNAKE_CASE__		):
           if self.graph[u].count([w, v]		) == 0:
             self.graph[u].append([w, v]		)
         else:
           A_      :				Any		     =					[[w, v]]
         if not self.graph.get(SCREAMING_SNAKE_CASE__		):
           A_      :				int		     =					[]



       def        _snake_case       (      self		)->Optional[int]:




         '''simple docstring'''





         return list(self.graph		)



       def        _snake_case       (      self				,       _SCREAMING_SNAKE_CASE				,       _SCREAMING_SNAKE_CASE		)->Optional[int]:




         '''simple docstring'''





         if self.graph.get(SCREAMING_SNAKE_CASE__		):
           for _ in self.graph[u]:
             if _[1] == v:
               self.graph[u].remove(SCREAMING_SNAKE_CASE__		)



       def        _snake_case       (      self				,       _SCREAMING_SNAKE_CASE=-2				,       _SCREAMING_SNAKE_CASE=-1		)->Optional[int]:




         '''simple docstring'''





         if s == d:
           return []
         A_      :				Optional[int]		     =					[]
         A_      :				int		     =					[]
         if s == -2:
           A_      :				Optional[Any]		     =					list(self.graph		)[0]
         stack.append(SCREAMING_SNAKE_CASE__		)
         visited.append(SCREAMING_SNAKE_CASE__		)
         A_      :				Dict		     =					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(SCREAMING_SNAKE_CASE__		)
                   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(SCREAMING_SNAKE_CASE__		) != 0:
               A_      :				List[str]		     =					stack[len(SCREAMING_SNAKE_CASE__		) - 1]
           else:
             A_      :				Optional[int]		     =					ss

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



       def        _snake_case       (      self				,       _SCREAMING_SNAKE_CASE=-1		)->int:




         '''simple docstring'''





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



       def        _snake_case       (      self				,       _SCREAMING_SNAKE_CASE=-2		)->Tuple:




         '''simple docstring'''





         A_      :				Tuple		     =					deque()
         A_      :				List[Any]		     =					[]
         if s == -2:
           A_      :				int		     =					list(self.graph		)[0]
         d.append(SCREAMING_SNAKE_CASE__		)
         visited.append(SCREAMING_SNAKE_CASE__		)
         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        _snake_case       (      self				,       _SCREAMING_SNAKE_CASE		)->Tuple:




         '''simple docstring'''





         A_      :				List[str]		     =					0
         for x in self.graph:
           for y in self.graph[x]:
             if y[1] == u:
               count += 1
         return count



       def        _snake_case       (      self				,       _SCREAMING_SNAKE_CASE		)->List[Any]:




         '''simple docstring'''





         return len(self.graph[u]		)



       def        _snake_case       (      self				,       _SCREAMING_SNAKE_CASE=-2		)->Union[str, Any]:




         '''simple docstring'''





         A_      :				List[str]		     =					[]
         A_      :				Dict		     =					[]
         if s == -2:
           A_      :				int		     =					list(self.graph		)[0]
         stack.append(SCREAMING_SNAKE_CASE__		)
         visited.append(SCREAMING_SNAKE_CASE__		)
         A_      :				int		     =					s
         A_      :				Tuple		     =					[]

         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:
                 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(SCREAMING_SNAKE_CASE__		) != 0:
               A_      :				Any		     =					stack[len(SCREAMING_SNAKE_CASE__		) - 1]
           else:
             A_      :				Optional[int]		     =					ss

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



       def        _snake_case       (      self		)->str:




         '''simple docstring'''





         A_      :				Optional[int]		     =					[]
         A_      :				int		     =					[]
         A_      :				str		     =					list(self.graph		)[0]
         stack.append(SCREAMING_SNAKE_CASE__		)
         visited.append(SCREAMING_SNAKE_CASE__		)
         A_      :				Dict		     =					-2
         A_      :				Optional[Any]		     =					[]
         A_      :				Dict		     =					s
         A_      :				Tuple		     =					False
         A_      :				Any		     =					set()

         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]		) > 0
                   and node[1] != parent
                   and indirect_parents.count(node[1]		) > 0
                   and not on_the_way_back
               ):
                 A_      :				Dict		     =					len(SCREAMING_SNAKE_CASE__		) - 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_      :				Union[str, Any]		     =					node[1]
                 break

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

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



       def        _snake_case       (      self		)->Any:




         '''simple docstring'''





         A_      :				Dict		     =					[]
         A_      :				List[Any]		     =					[]
         A_      :				Dict		     =					list(self.graph		)[0]
         stack.append(SCREAMING_SNAKE_CASE__		)
         visited.append(SCREAMING_SNAKE_CASE__		)
         A_      :				str		     =					-2
         A_      :				Optional[Any]		     =					[]
         A_      :				Any		     =					s
         A_      :				Tuple		     =					False
         A_      :				Dict		     =					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_      :				int		     =					len(SCREAMING_SNAKE_CASE__		) - 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_      :				Union[str, Any]		     =					node[1]
                 break

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

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



       def        _snake_case       (      self				,       _SCREAMING_SNAKE_CASE=-2				,       _SCREAMING_SNAKE_CASE=-1		)->str:




         '''simple docstring'''





         A_      :				Optional[int]		     =					time()
         self.dfs(SCREAMING_SNAKE_CASE__				,       SCREAMING_SNAKE_CASE__		)
         A_      :				Tuple		     =					time()
         return end - begin







       def        _snake_case       (      self				,       _SCREAMING_SNAKE_CASE=-2		)->Tuple:




         '''simple docstring'''





         A_      :				str		     =					time()
         self.bfs(SCREAMING_SNAKE_CASE__		)
         A_      :				Optional[Any]		     =					time()
         return end - begin






class   _lowerCamelCase :




       """simple docstring"""



       def __init__(      self		)->Dict:




         '''simple docstring'''





         A_      :				List[Any]		     =					{}



       def        _snake_case       (      self				,       _SCREAMING_SNAKE_CASE				,       _SCREAMING_SNAKE_CASE				,       _SCREAMING_SNAKE_CASE=1		)->Optional[Any]:




         '''simple docstring'''





         if self.graph.get(SCREAMING_SNAKE_CASE__		):
           # 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(SCREAMING_SNAKE_CASE__		):
           # 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_      :				Union[str, Any]		     =					[[w, u]]



       def        _snake_case       (      self				,       _SCREAMING_SNAKE_CASE				,       _SCREAMING_SNAKE_CASE		)->Optional[int]:




         '''simple docstring'''





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



       def        _snake_case       (      self				,       _SCREAMING_SNAKE_CASE=-2				,       _SCREAMING_SNAKE_CASE=-1		)->Optional[Any]:




         '''simple docstring'''





         if s == d:
           return []
         A_      :				Optional[Any]		     =					[]
         A_      :				Union[str, Any]		     =					[]
         if s == -2:
           A_      :				Any		     =					list(self.graph		)[0]
         stack.append(SCREAMING_SNAKE_CASE__		)
         visited.append(SCREAMING_SNAKE_CASE__		)
         A_      :				Union[str, Any]		     =					s

         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]		) < 1:
                 if node[1] == d:
                   visited.append(SCREAMING_SNAKE_CASE__		)
                   return visited
                 else:
                   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()
             if len(SCREAMING_SNAKE_CASE__		) != 0:
               A_      :				Any		     =					stack[len(SCREAMING_SNAKE_CASE__		) - 1]
           else:
             A_      :				Optional[Any]		     =					ss

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



       def        _snake_case       (      self				,       _SCREAMING_SNAKE_CASE=-1		)->Optional[Any]:




         '''simple docstring'''





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



       def        _snake_case       (      self				,       _SCREAMING_SNAKE_CASE=-2		)->List[Any]:




         '''simple docstring'''





         A_      :				Union[str, Any]		     =					deque()
         A_      :				Union[str, Any]		     =					[]
         if s == -2:
           A_      :				int		     =					list(self.graph		)[0]
         d.append(SCREAMING_SNAKE_CASE__		)
         visited.append(SCREAMING_SNAKE_CASE__		)
         while d:
           A_      :				Optional[int]		     =					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        _snake_case       (      self				,       _SCREAMING_SNAKE_CASE		)->Any:




         '''simple docstring'''





         return len(self.graph[u]		)



       def        _snake_case       (      self		)->Optional[int]:




         '''simple docstring'''





         A_      :				List[str]		     =					[]
         A_      :				Dict		     =					[]
         A_      :				Union[str, Any]		     =					list(self.graph		)[0]
         stack.append(SCREAMING_SNAKE_CASE__		)
         visited.append(SCREAMING_SNAKE_CASE__		)
         A_      :				List[str]		     =					-2
         A_      :				Any		     =					[]
         A_      :				List[Any]		     =					s
         A_      :				Optional[int]		     =					False
         A_      :				Union[str, Any]		     =					set()

         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]		) > 0
                   and node[1] != parent
                   and indirect_parents.count(node[1]		) > 0
                   and not on_the_way_back
               ):
                 A_      :				Optional[int]		     =					len(SCREAMING_SNAKE_CASE__		) - 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_      :				int		     =					node[1]
                 break

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

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



       def        _snake_case       (      self		)->Any:




         '''simple docstring'''





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

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

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

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



       def        _snake_case       (      self		)->Optional[Any]:




         '''simple docstring'''





         return list(self.graph		)



       def        _snake_case       (      self				,       _SCREAMING_SNAKE_CASE=-2				,       _SCREAMING_SNAKE_CASE=-1		)->Optional[int]:




         '''simple docstring'''





         A_      :				Optional[int]		     =					time()
         self.dfs(SCREAMING_SNAKE_CASE__				,       SCREAMING_SNAKE_CASE__		)
         A_      :				str		     =					time()
         return end - begin







       def        _snake_case       (      self				,       _SCREAMING_SNAKE_CASE=-2		)->Dict:




         '''simple docstring'''





         A_      :				str		     =					time()
         self.bfs(SCREAMING_SNAKE_CASE__		)
         A_      :				str		     =					time()
         return end - begin





'''simple docstring'''

import warnings

from ...utils import logging
from .image_processing_segformer import SegformerImageProcessor


_A			:      Optional[int]					      =				logging.get_logger(__name__)







class 				_lowercase     (				UpperCAmelCase__			):


 '''simple docstring'''






 def __init__(      self   :	Dict      ,       *SCREAMING_SNAKE_CASE__   :	Optional[int]      ,       **SCREAMING_SNAKE_CASE__   :	List[str]							)  ->    None:
  warnings.warn(
      """The class SegformerFeatureExtractor is deprecated and will be removed in version 5 of Transformers."""
      """ Please use SegformerImageProcessor instead."""      ,       SCREAMING_SNAKE_CASE__      ,       )
  super().__init__(*SCREAMING_SNAKE_CASE__      ,       **SCREAMING_SNAKE_CASE__							)






