# A Bipartite Graph is a graph whose vertices can be divided into two independent sets,
# U and V such that every edge (u, v) either connects a vertex from U to V or a vertex
# from V to U. In other words, for every edge (u, v), either u belongs to U and v to V,
# or u belongs to V and v to U. We can also say that there is no edge that connects
# vertices of same set.
from queue import Queue






def    __lowerCamelCase	(		lowerCAmelCase__			):
       lowerCAmelCase__  			=      Queue()
       lowerCAmelCase__  			=      [False] * len(lowerCAmelCase__			)
       lowerCAmelCase__  			=      [-1] * len(lowerCAmelCase__			)

       def bfs():
              while not queue.empty():
                     lowerCAmelCase__  			=      queue.get()
                     lowerCAmelCase__  			=      True

                     for neighbour in graph[u]:
                            if neighbour == u:
                                   return False

                            if color[neighbour] == -1:
                                   lowerCAmelCase__  			=      1 - color[u]
                                   queue.put(lowerCAmelCase__			)

                            elif color[neighbour] == color[u]:
                                   return False

              return True

       for i in range(len(lowerCAmelCase__			)			):
              if not visited[i]:
                     queue.put(lowerCAmelCase__			)
                     lowerCAmelCase__  			=      0
                     if bfs() is False:
                            return False

       return True


if __name__ == "__main__":
    # Adjacency List of graph
    print(check_bipartite({0: [1, 3], 1: [0, 2], 2: [1, 3], 3: [0, 2]}))

from ..utils import DummyObject, requires_backends
class        a_				(		metaclass=SCREAMING_SNAKE_CASE		):






 '''simple docstring'''






 UpperCAmelCase_							=      ['tokenizers']




 def __init__(    self      :						List[str]    ,					*lowercase__      :						Any    ,					**lowercase__      :						List[Any]):







        '''simple docstring'''



        requires_backends(self    ,					['tokenizers'])






class        a_				(		metaclass=SCREAMING_SNAKE_CASE		):






 '''simple docstring'''






 UpperCAmelCase_							=      ['tokenizers']




 def __init__(    self      :						str    ,					*lowercase__      :						List[str]    ,					**lowercase__      :						List[str]):







        '''simple docstring'''



        requires_backends(self    ,					['tokenizers'])






class        a_				(		metaclass=SCREAMING_SNAKE_CASE		):






 '''simple docstring'''






 UpperCAmelCase_							=      ['tokenizers']




 def __init__(    self      :						str    ,					*lowercase__      :						Dict    ,					**lowercase__      :						List[str]):







        '''simple docstring'''



        requires_backends(self    ,					['tokenizers'])






class        a_				(		metaclass=SCREAMING_SNAKE_CASE		):






 '''simple docstring'''






 UpperCAmelCase_							=      ['tokenizers']




 def __init__(    self      :						Dict    ,					*lowercase__      :						int    ,					**lowercase__      :						Dict):







        '''simple docstring'''



        requires_backends(self    ,					['tokenizers'])






class        a_				(		metaclass=SCREAMING_SNAKE_CASE		):






 '''simple docstring'''






 UpperCAmelCase_							=      ['tokenizers']




 def __init__(    self      :						Optional[Any]    ,					*lowercase__      :						Dict    ,					**lowercase__      :						List[str]):







        '''simple docstring'''



        requires_backends(self    ,					['tokenizers'])






class        a_				(		metaclass=SCREAMING_SNAKE_CASE		):






 '''simple docstring'''






 UpperCAmelCase_							=      ['tokenizers']




 def __init__(    self      :						Any    ,					*lowercase__      :						int    ,					**lowercase__      :						str):







        '''simple docstring'''



        requires_backends(self    ,					['tokenizers'])






class        a_				(		metaclass=SCREAMING_SNAKE_CASE		):






 '''simple docstring'''






 UpperCAmelCase_							=      ['tokenizers']




 def __init__(    self      :						str    ,					*lowercase__      :						Dict    ,					**lowercase__      :						int):







        '''simple docstring'''



        requires_backends(self    ,					['tokenizers'])






class        a_				(		metaclass=SCREAMING_SNAKE_CASE		):






 '''simple docstring'''






 UpperCAmelCase_							=      ['tokenizers']




 def __init__(    self      :						List[str]    ,					*lowercase__      :						Dict    ,					**lowercase__      :						Dict):







        '''simple docstring'''



        requires_backends(self    ,					['tokenizers'])






class        a_				(		metaclass=SCREAMING_SNAKE_CASE		):






 '''simple docstring'''






 UpperCAmelCase_							=      ['tokenizers']




 def __init__(    self      :						Any    ,					*lowercase__      :						Tuple    ,					**lowercase__      :						Dict):







        '''simple docstring'''



        requires_backends(self    ,					['tokenizers'])






class        a_				(		metaclass=SCREAMING_SNAKE_CASE		):






 '''simple docstring'''






 UpperCAmelCase_							=      ['tokenizers']




 def __init__(    self      :						List[Any]    ,					*lowercase__      :						int    ,					**lowercase__      :						Tuple):







        '''simple docstring'''



        requires_backends(self    ,					['tokenizers'])






class        a_				(		metaclass=SCREAMING_SNAKE_CASE		):






 '''simple docstring'''






 UpperCAmelCase_							=      ['tokenizers']




 def __init__(    self      :						int    ,					*lowercase__      :						Optional[Any]    ,					**lowercase__      :						Union[str, Any]):







        '''simple docstring'''



        requires_backends(self    ,					['tokenizers'])






class        a_				(		metaclass=SCREAMING_SNAKE_CASE		):






 '''simple docstring'''






 UpperCAmelCase_							=      ['tokenizers']




 def __init__(    self      :						Tuple    ,					*lowercase__      :						Dict    ,					**lowercase__      :						Any):







        '''simple docstring'''



        requires_backends(self    ,					['tokenizers'])






class        a_				(		metaclass=SCREAMING_SNAKE_CASE		):






 '''simple docstring'''






 UpperCAmelCase_							=      ['tokenizers']




 def __init__(    self      :						Tuple    ,					*lowercase__      :						Optional[Any]    ,					**lowercase__      :						Any):







        '''simple docstring'''



        requires_backends(self    ,					['tokenizers'])






class        a_				(		metaclass=SCREAMING_SNAKE_CASE		):






 '''simple docstring'''






 UpperCAmelCase_							=      ['tokenizers']




 def __init__(    self      :						str    ,					*lowercase__      :						Union[str, Any]    ,					**lowercase__      :						Dict):







        '''simple docstring'''



        requires_backends(self    ,					['tokenizers'])






class        a_				(		metaclass=SCREAMING_SNAKE_CASE		):






 '''simple docstring'''






 UpperCAmelCase_							=      ['tokenizers']




 def __init__(    self      :						int    ,					*lowercase__      :						Tuple    ,					**lowercase__      :						List[str]):







        '''simple docstring'''



        requires_backends(self    ,					['tokenizers'])






class        a_				(		metaclass=SCREAMING_SNAKE_CASE		):






 '''simple docstring'''






 UpperCAmelCase_							=      ['tokenizers']




 def __init__(    self      :						Optional[Any]    ,					*lowercase__      :						List[Any]    ,					**lowercase__      :						Union[str, Any]):







        '''simple docstring'''



        requires_backends(self    ,					['tokenizers'])






class        a_				(		metaclass=SCREAMING_SNAKE_CASE		):






 '''simple docstring'''






 UpperCAmelCase_							=      ['tokenizers']




 def __init__(    self      :						List[str]    ,					*lowercase__      :						List[Any]    ,					**lowercase__      :						Any):







        '''simple docstring'''



        requires_backends(self    ,					['tokenizers'])






class        a_				(		metaclass=SCREAMING_SNAKE_CASE		):






 '''simple docstring'''






 UpperCAmelCase_							=      ['tokenizers']




 def __init__(    self      :						str    ,					*lowercase__      :						Optional[int]    ,					**lowercase__      :						Optional[Any]):







        '''simple docstring'''



        requires_backends(self    ,					['tokenizers'])






class        a_				(		metaclass=SCREAMING_SNAKE_CASE		):






 '''simple docstring'''






 UpperCAmelCase_							=      ['tokenizers']




 def __init__(    self      :						str    ,					*lowercase__      :						Any    ,					**lowercase__      :						Tuple):







        '''simple docstring'''



        requires_backends(self    ,					['tokenizers'])






class        a_				(		metaclass=SCREAMING_SNAKE_CASE		):






 '''simple docstring'''






 UpperCAmelCase_							=      ['tokenizers']




 def __init__(    self      :						int    ,					*lowercase__      :						Union[str, Any]    ,					**lowercase__      :						Tuple):







        '''simple docstring'''



        requires_backends(self    ,					['tokenizers'])






class        a_				(		metaclass=SCREAMING_SNAKE_CASE		):






 '''simple docstring'''






 UpperCAmelCase_							=      ['tokenizers']




 def __init__(    self      :						str    ,					*lowercase__      :						List[str]    ,					**lowercase__      :						Tuple):







        '''simple docstring'''



        requires_backends(self    ,					['tokenizers'])






class        a_				(		metaclass=SCREAMING_SNAKE_CASE		):






 '''simple docstring'''






 UpperCAmelCase_							=      ['tokenizers']




 def __init__(    self      :						Any    ,					*lowercase__      :						Dict    ,					**lowercase__      :						Tuple):







        '''simple docstring'''



        requires_backends(self    ,					['tokenizers'])






class        a_				(		metaclass=SCREAMING_SNAKE_CASE		):






 '''simple docstring'''






 UpperCAmelCase_							=      ['tokenizers']




 def __init__(    self      :						str    ,					*lowercase__      :						Tuple    ,					**lowercase__      :						List[Any]):







        '''simple docstring'''



        requires_backends(self    ,					['tokenizers'])






class        a_				(		metaclass=SCREAMING_SNAKE_CASE		):






 '''simple docstring'''






 UpperCAmelCase_							=      ['tokenizers']




 def __init__(    self      :						int    ,					*lowercase__      :						Dict    ,					**lowercase__      :						Dict):







        '''simple docstring'''



        requires_backends(self    ,					['tokenizers'])






class        a_				(		metaclass=SCREAMING_SNAKE_CASE		):






 '''simple docstring'''






 UpperCAmelCase_							=      ['tokenizers']




 def __init__(    self      :						List[str]    ,					*lowercase__      :						List[Any]    ,					**lowercase__      :						Optional[Any]):







        '''simple docstring'''



        requires_backends(self    ,					['tokenizers'])






class        a_				(		metaclass=SCREAMING_SNAKE_CASE		):






 '''simple docstring'''






 UpperCAmelCase_							=      ['tokenizers']




 def __init__(    self      :						List[str]    ,					*lowercase__      :						Any    ,					**lowercase__      :						List[str]):







        '''simple docstring'''



        requires_backends(self    ,					['tokenizers'])






class        a_				(		metaclass=SCREAMING_SNAKE_CASE		):






 '''simple docstring'''






 UpperCAmelCase_							=      ['tokenizers']




 def __init__(    self      :						int    ,					*lowercase__      :						Union[str, Any]    ,					**lowercase__      :						Optional[Any]):







        '''simple docstring'''



        requires_backends(self    ,					['tokenizers'])






class        a_				(		metaclass=SCREAMING_SNAKE_CASE		):






 '''simple docstring'''






 UpperCAmelCase_							=      ['tokenizers']




 def __init__(    self      :						Tuple    ,					*lowercase__      :						Any    ,					**lowercase__      :						Tuple):







        '''simple docstring'''



        requires_backends(self    ,					['tokenizers'])






class        a_				(		metaclass=SCREAMING_SNAKE_CASE		):






 '''simple docstring'''






 UpperCAmelCase_							=      ['tokenizers']




 def __init__(    self      :						Dict    ,					*lowercase__      :						Optional[int]    ,					**lowercase__      :						Dict):







        '''simple docstring'''



        requires_backends(self    ,					['tokenizers'])






class        a_				(		metaclass=SCREAMING_SNAKE_CASE		):






 '''simple docstring'''






 UpperCAmelCase_							=      ['tokenizers']




 def __init__(    self      :						List[Any]    ,					*lowercase__      :						str    ,					**lowercase__      :						List[str]):







        '''simple docstring'''



        requires_backends(self    ,					['tokenizers'])






class        a_				(		metaclass=SCREAMING_SNAKE_CASE		):






 '''simple docstring'''






 UpperCAmelCase_							=      ['tokenizers']




 def __init__(    self      :						Optional[int]    ,					*lowercase__      :						Any    ,					**lowercase__      :						Union[str, Any]):







        '''simple docstring'''



        requires_backends(self    ,					['tokenizers'])






class        a_				(		metaclass=SCREAMING_SNAKE_CASE		):






 '''simple docstring'''






 UpperCAmelCase_							=      ['tokenizers']




 def __init__(    self      :						Optional[int]    ,					*lowercase__      :						List[str]    ,					**lowercase__      :						Optional[Any]):







        '''simple docstring'''



        requires_backends(self    ,					['tokenizers'])






class        a_				(		metaclass=SCREAMING_SNAKE_CASE		):






 '''simple docstring'''






 UpperCAmelCase_							=      ['tokenizers']




 def __init__(    self      :						Dict    ,					*lowercase__      :						List[Any]    ,					**lowercase__      :						Tuple):







        '''simple docstring'''



        requires_backends(self    ,					['tokenizers'])






class        a_				(		metaclass=SCREAMING_SNAKE_CASE		):






 '''simple docstring'''






 UpperCAmelCase_							=      ['tokenizers']




 def __init__(    self      :						Any    ,					*lowercase__      :						Union[str, Any]    ,					**lowercase__      :						Optional[Any]):







        '''simple docstring'''



        requires_backends(self    ,					['tokenizers'])






class        a_				(		metaclass=SCREAMING_SNAKE_CASE		):






 '''simple docstring'''






 UpperCAmelCase_							=      ['tokenizers']




 def __init__(    self      :						List[Any]    ,					*lowercase__      :						Tuple    ,					**lowercase__      :						Optional[int]):







        '''simple docstring'''



        requires_backends(self    ,					['tokenizers'])






class        a_				(		metaclass=SCREAMING_SNAKE_CASE		):






 '''simple docstring'''






 UpperCAmelCase_							=      ['tokenizers']




 def __init__(    self      :						int    ,					*lowercase__      :						Any    ,					**lowercase__      :						str):







        '''simple docstring'''



        requires_backends(self    ,					['tokenizers'])






class        a_				(		metaclass=SCREAMING_SNAKE_CASE		):






 '''simple docstring'''






 UpperCAmelCase_							=      ['tokenizers']




 def __init__(    self      :						Dict    ,					*lowercase__      :						Dict    ,					**lowercase__      :						List[str]):







        '''simple docstring'''



        requires_backends(self    ,					['tokenizers'])






class        a_				(		metaclass=SCREAMING_SNAKE_CASE		):






 '''simple docstring'''






 UpperCAmelCase_							=      ['tokenizers']




 def __init__(    self      :						List[Any]    ,					*lowercase__      :						str    ,					**lowercase__      :						Optional[Any]):







        '''simple docstring'''



        requires_backends(self    ,					['tokenizers'])






class        a_				(		metaclass=SCREAMING_SNAKE_CASE		):






 '''simple docstring'''






 UpperCAmelCase_							=      ['tokenizers']




 def __init__(    self      :						Optional[int]    ,					*lowercase__      :						str    ,					**lowercase__      :						List[Any]):







        '''simple docstring'''



        requires_backends(self    ,					['tokenizers'])






class        a_				(		metaclass=SCREAMING_SNAKE_CASE		):






 '''simple docstring'''






 UpperCAmelCase_							=      ['tokenizers']




 def __init__(    self      :						List[str]    ,					*lowercase__      :						Any    ,					**lowercase__      :						Union[str, Any]):







        '''simple docstring'''



        requires_backends(self    ,					['tokenizers'])






class        a_				(		metaclass=SCREAMING_SNAKE_CASE		):






 '''simple docstring'''






 UpperCAmelCase_							=      ['tokenizers']




 def __init__(    self      :						Optional[Any]    ,					*lowercase__      :						int    ,					**lowercase__      :						Tuple):







        '''simple docstring'''



        requires_backends(self    ,					['tokenizers'])






class        a_				(		metaclass=SCREAMING_SNAKE_CASE		):






 '''simple docstring'''






 UpperCAmelCase_							=      ['tokenizers']




 def __init__(    self      :						List[Any]    ,					*lowercase__      :						Union[str, Any]    ,					**lowercase__      :						Optional[int]):







        '''simple docstring'''



        requires_backends(self    ,					['tokenizers'])






class        a_				(		metaclass=SCREAMING_SNAKE_CASE		):






 '''simple docstring'''






 UpperCAmelCase_							=      ['tokenizers']




 def __init__(    self      :						List[str]    ,					*lowercase__      :						Optional[int]    ,					**lowercase__      :						Optional[int]):







        '''simple docstring'''



        requires_backends(self    ,					['tokenizers'])






class        a_				(		metaclass=SCREAMING_SNAKE_CASE		):






 '''simple docstring'''






 UpperCAmelCase_							=      ['tokenizers']




 def __init__(    self      :						Union[str, Any]    ,					*lowercase__      :						Optional[int]    ,					**lowercase__      :						Optional[Any]):







        '''simple docstring'''



        requires_backends(self    ,					['tokenizers'])






class        a_				(		metaclass=SCREAMING_SNAKE_CASE		):






 '''simple docstring'''






 UpperCAmelCase_							=      ['tokenizers']




 def __init__(    self      :						Optional[int]    ,					*lowercase__      :						Optional[int]    ,					**lowercase__      :						int):







        '''simple docstring'''



        requires_backends(self    ,					['tokenizers'])






class        a_				(		metaclass=SCREAMING_SNAKE_CASE		):






 '''simple docstring'''






 UpperCAmelCase_							=      ['tokenizers']




 def __init__(    self      :						Any    ,					*lowercase__      :						Dict    ,					**lowercase__      :						Optional[Any]):







        '''simple docstring'''



        requires_backends(self    ,					['tokenizers'])






class        a_				(		metaclass=SCREAMING_SNAKE_CASE		):






 '''simple docstring'''






 UpperCAmelCase_							=      ['tokenizers']




 def __init__(    self      :						Any    ,					*lowercase__      :						Tuple    ,					**lowercase__      :						List[str]):







        '''simple docstring'''



        requires_backends(self    ,					['tokenizers'])






class        a_				(		metaclass=SCREAMING_SNAKE_CASE		):






 '''simple docstring'''






 UpperCAmelCase_							=      ['tokenizers']




 def __init__(    self      :						Union[str, Any]    ,					*lowercase__      :						Union[str, Any]    ,					**lowercase__      :						Tuple):







        '''simple docstring'''



        requires_backends(self    ,					['tokenizers'])






class        a_				(		metaclass=SCREAMING_SNAKE_CASE		):






 '''simple docstring'''






 UpperCAmelCase_							=      ['tokenizers']




 def __init__(    self      :						Optional[Any]    ,					*lowercase__      :						Tuple    ,					**lowercase__      :						Optional[Any]):







        '''simple docstring'''



        requires_backends(self    ,					['tokenizers'])






class        a_				(		metaclass=SCREAMING_SNAKE_CASE		):






 '''simple docstring'''






 UpperCAmelCase_							=      ['tokenizers']




 def __init__(    self      :						Union[str, Any]    ,					*lowercase__      :						Union[str, Any]    ,					**lowercase__      :						List[str]):







        '''simple docstring'''



        requires_backends(self    ,					['tokenizers'])






class        a_				(		metaclass=SCREAMING_SNAKE_CASE		):






 '''simple docstring'''






 UpperCAmelCase_							=      ['tokenizers']




 def __init__(    self      :						Optional[int]    ,					*lowercase__      :						Optional[int]    ,					**lowercase__      :						str):







        '''simple docstring'''



        requires_backends(self    ,					['tokenizers'])






class        a_				(		metaclass=SCREAMING_SNAKE_CASE		):






 '''simple docstring'''






 UpperCAmelCase_							=      ['tokenizers']




 def __init__(    self      :						Optional[int]    ,					*lowercase__      :						Any    ,					**lowercase__      :						Any):







        '''simple docstring'''



        requires_backends(self    ,					['tokenizers'])






class        a_				(		metaclass=SCREAMING_SNAKE_CASE		):






 '''simple docstring'''






 UpperCAmelCase_							=      ['tokenizers']




 def __init__(    self      :						str    ,					*lowercase__      :						Dict    ,					**lowercase__      :						Optional[Any]):







        '''simple docstring'''



        requires_backends(self    ,					['tokenizers'])






class        a_				(		metaclass=SCREAMING_SNAKE_CASE		):






 '''simple docstring'''






 UpperCAmelCase_							=      ['tokenizers']




 def __init__(    self      :						List[str]    ,					*lowercase__      :						str    ,					**lowercase__      :						Tuple):







        '''simple docstring'''



        requires_backends(self    ,					['tokenizers'])






class        a_				(		metaclass=SCREAMING_SNAKE_CASE		):






 '''simple docstring'''






 UpperCAmelCase_							=      ['tokenizers']




 def __init__(    self      :						Any    ,					*lowercase__      :						Dict    ,					**lowercase__      :						Tuple):







        '''simple docstring'''



        requires_backends(self    ,					['tokenizers'])






class        a_				(		metaclass=SCREAMING_SNAKE_CASE		):






 '''simple docstring'''






 UpperCAmelCase_							=      ['tokenizers']




 def __init__(    self      :						Tuple    ,					*lowercase__      :						Any    ,					**lowercase__      :						Dict):







        '''simple docstring'''



        requires_backends(self    ,					['tokenizers'])






class        a_				(		metaclass=SCREAMING_SNAKE_CASE		):






 '''simple docstring'''






 UpperCAmelCase_							=      ['tokenizers']




 def __init__(    self      :						Union[str, Any]    ,					*lowercase__      :						Optional[int]    ,					**lowercase__      :						Optional[int]):







        '''simple docstring'''



        requires_backends(self    ,					['tokenizers'])






class        a_				(		metaclass=SCREAMING_SNAKE_CASE		):






 '''simple docstring'''






 UpperCAmelCase_							=      ['tokenizers']




 def __init__(    self      :						Dict    ,					*lowercase__      :						Optional[int]    ,					**lowercase__      :						str):







        '''simple docstring'''



        requires_backends(self    ,					['tokenizers'])
