code: 
  
  
  
  
  
  from __future__ import annotations
  
  from queue import Queue
  
  
  
  
  
  
  class 	UpperCamelCase_     :
  
  
  
  					def __init__(		self    :    Dict	):
  							lowerCamelCase_  :    dict[int, list[int]]   	=			{}
  
  
  
  					def      __a    (		self    :    str	):
  							for i in self.vertices:
  									print(lowerCamelCase					,			' : '					,			' -> '.join([str(lowerCamelCase	) for j in self.vertices[i]]	)	)
  
  
  
  					def      __a    (		self    :    Dict					,			lowerCamelCase    :    int					,			lowerCamelCase    :    int	):
  							if from_vertex in self.vertices:
  									self.vertices[from_vertex].append(lowerCamelCase	)
  							else:
  									lowerCamelCase_  :    str   	=			[to_vertex]
  
  
  
  
  
  					def      __a    (		self    :    List[Any]					,			lowerCamelCase    :    int	):
  							lowerCamelCase_  :    Optional[Any]   	=			set()
  
  							# create a first in first out queue to store all the vertices for BFS
  							lowerCamelCase_  :    Queue   	=			Queue()
  
  							# mark the source node as visited and enqueue it
  							visited.add(lowerCamelCase	)
  							queue.put(lowerCamelCase	)
  
  							while not queue.empty():
  									lowerCamelCase_  :    str   	=			queue.get()
  
  									# loop through all adjacent vertex and enqueue it if not yet visited
  									for adjacent_vertex in self.vertices[vertex]:
  											if adjacent_vertex not in visited:
  													queue.put(lowerCamelCase	)
  													visited.add(lowerCamelCase	)
  							return visited
  
  
  if __name__ == "__main__":
  		from doctest import testmod
  
  		testmod(verbose=True)
  
  		_lowercase		:     Any 					=Graph()
  		g.add_edge(0, 1)
  		g.add_edge(0, 2)
  		g.add_edge(1, 2)
  		g.add_edge(2, 0)
  		g.add_edge(2, 3)
  		g.add_edge(3, 3)
  
  		g.print_graph()
  		# 0  :  1 -> 2
  		# 1  :  2
  		# 2  :  0 -> 3
  		# 3  :  3
  
  		assert sorted(g.bfs(2)) == [0, 1, 2, 3]
  
style_context: 
  
  
  
  
  
  def 		_SCREAMING_SNAKE_CASE    (   lowerCAmelCase__       ,lowerCAmelCase__	):
  		return (input_a, input_a).count(0	) % 2
  
  
  def 		_SCREAMING_SNAKE_CASE    (   ):
  		assert xor_gate(0       ,0	) == 0
  		assert xor_gate(0       ,1	) == 1
  		assert xor_gate(1       ,0	) == 1
  		assert xor_gate(1       ,1	) == 0
  
  
  if __name__ == "__main__":
  		print(xor_gate(0, 0))
  		print(xor_gate(0, 1))
  