


def 							__lowercase       (			__lowerCAmelCase							:    Any       ):
							a__					=					[0] * len(_snake_case       )
							a__					=					[]
							a__					=					[]
							a__					=					0

							for values in graph.values():
														for i in values:
																					indegree[i] += 1

							for i in range(len(_snake_case       )       ):
														if indegree[i] == 0:
																					queue.append(_snake_case       )

							while queue:
														a__					=					queue.pop(0       )
														cnt += 1
														topo.append(_snake_case       )
														for x in graph[vertex]:
																					indegree[x] -= 1
																					if indegree[x] == 0:
																												queue.append(_snake_case       )

							if cnt != len(_snake_case       ):
														print('Cycle exists'       )
							else:
														print(_snake_case       )


# Adjacency List of Graph
snake_case					      =				{0: [1, 2], 1: [3], 2: [3], 3: [4, 5], 4: [], 5: []}






topological_sort(graph)








from __future__ import annotations







class 	snake_case_       :
					def __init__(				self       :List[str]      ,__snake_case       :int				) ->   None:
												a__					=					data
												a__					=					None
												a__					=					None






def 							__lowercase       (			__lowerCAmelCase							:    Node | None       ):  # In Order traversal of the tree
							if tree:
														display(tree.left       )
														print(tree.data       )
														display(tree.right       )






def 							__lowercase       (			__lowerCAmelCase							:    Node | None       ):
							return 1 + max(depth_of_tree(tree.left       ) ,   depth_of_tree(tree.right       )       ) if tree else 0






def 							__lowercase       (			__lowerCAmelCase							:    Node       ):
							if not tree:
														return True
							if tree.left and tree.right:
														return is_full_binary_tree(tree.left       ) and is_full_binary_tree(tree.right       )
							else:
														return not tree.left and not tree.right






def 							__lowercase       (			):  # Main function for testing.
							a__					=					Node(1       )
							a__					=					Node(2       )
							a__					=					Node(3       )
							a__					=					Node(4       )
							a__					=					Node(5       )
							a__					=					Node(6       )
							a__					=					Node(7       )
							a__					=					Node(8       )
							a__					=					Node(9       )

							print(is_full_binary_tree(__lowerCAmelCase       )       )
							print(depth_of_tree(__lowerCAmelCase       )       )
							print('Tree is: '       )
							display(__lowerCAmelCase       )


if __name__ == "__main__":
						main()




