from __future__ import annotations

import queue




class    _UpperCamelCase      :


			"""simple docstring"""






			def __init__(   self      ,   lowerCAmelCase__						)     ->					Union[str, Any]:

							'''simple docstring'''


							__lowercase 			=							data
							__lowercase 			=							None
							__lowercase 			=							None





def 				UpperCAmelCase						(    ):







				"""simple docstring"""



				print('''\n********Press N to stop entering at any point of time********\n'''							)
				__lowercase 			=							input('''Enter the value of the root node: '''							).strip().lower()
				__lowercase 			=							queue.Queue()
				__lowercase 			=							TreeNode(int(lowercase							)							)
				q.put(lowercase							)
				while not q.empty():
								__lowercase 			=							q.get()
								__lowercase 			=							F"Enter the left node of {node_found.data}: "
								__lowercase 			=							input(lowercase							).strip().lower() or '''n'''
								if check == "n":
												return tree_node
								__lowercase 			=							TreeNode(int(lowercase							)							)
								__lowercase 			=							left_node
								q.put(lowercase							)
								__lowercase 			=							F"Enter the right node of {node_found.data}: "
								__lowercase 			=							input(lowercase							).strip().lower() or '''n'''
								if check == "n":
												return tree_node
								__lowercase 			=							TreeNode(int(lowercase							)							)
								__lowercase 			=							right_node
								q.put(lowercase							)
				raise





def 				UpperCAmelCase						(    lowercase							):







				"""simple docstring"""



				if not isinstance(lowercase							,			lowercase							) or not node:
								return
				print(node.data							,			end=''','''							)
				pre_order(node.left							)
				pre_order(node.right							)





def 				UpperCAmelCase						(    lowercase							):







				"""simple docstring"""



				if not isinstance(lowercase							,			lowercase							) or not node:
								return
				in_order(node.left							)
				print(node.data							,			end=''','''							)
				in_order(node.right							)





def 				UpperCAmelCase						(    lowercase							):







				"""simple docstring"""



				if not isinstance(lowercase							,			lowercase							) or not node:
								return
				post_order(node.left							)
				post_order(node.right							)
				print(node.data							,			end=''','''							)





def 				UpperCAmelCase						(    lowercase							):







				"""simple docstring"""



				if not isinstance(lowercase							,			lowercase							) or not node:
								return
				__lowercase 			=							queue.Queue()
				q.put(lowercase							)
				while not q.empty():
								__lowercase 			=							q.get()
								print(node_dequeued.data							,			end=''','''							)
								if node_dequeued.left:
												q.put(node_dequeued.left							)
								if node_dequeued.right:
												q.put(node_dequeued.right							)





def 				UpperCAmelCase						(    lowercase							):







				"""simple docstring"""



				if not isinstance(lowercase							,			lowercase							) or not node:
								return
				__lowercase 			=							queue.Queue()
				q.put(lowercase							)
				while not q.empty():
								__lowercase 			=							[]
								while not q.empty():
												__lowercase 			=							q.get()
												print(node_dequeued.data							,			end=''','''							)
												if node_dequeued.left:
																list_.append(node_dequeued.left							)
												if node_dequeued.right:
																list_.append(node_dequeued.right							)
								print()
								for node in list_:
												q.put(lowercase							)





def 				UpperCAmelCase						(    lowercase							):







				"""simple docstring"""



				if not isinstance(lowercase							,			lowercase							) or not node:
								return
				__lowercase 			=							[]
				__lowercase 			=							node
				while n or stack:
								while n:  # start from root node, find its left child
												print(n.data							,			end=''','''							)
												stack.append(lowercase							)
												__lowercase 			=							n.left
								# end of while means current node doesn't have left child
								__lowercase 			=							stack.pop()
								# start to traverse its right child
								__lowercase 			=							n.right





def 				UpperCAmelCase						(    lowercase							):







				"""simple docstring"""



				if not isinstance(lowercase							,			lowercase							) or not node:
								return
				__lowercase 			=							[]
				__lowercase 			=							node
				while n or stack:
								while n:
												stack.append(lowercase							)
												__lowercase 			=							n.left
								__lowercase 			=							stack.pop()
								print(n.data							,			end=''','''							)
								__lowercase 			=							n.right





def 				UpperCAmelCase						(    lowercase							):







				"""simple docstring"""



				if not isinstance(lowercase							,			lowercase							) or not node:
								return
				__lowercase			,     __lowercase 			=							[], []
				__lowercase 			=							node
				stacka.append(lowercase							)
				while stacka:  # to find the reversed order of post order, store it in stack2
								__lowercase 			=							stacka.pop()
								if n.left:
												stacka.append(n.left							)
								if n.right:
												stacka.append(n.right							)
								stacka.append(lowercase							)
				while stacka:  # pop up from stack2 will be the post order
								print(stacka.pop().data							,			end=''','''							)





def 				UpperCAmelCase						(    lowercase = ""							,			lowercase=50							,			lowercase="*"							):







				"""simple docstring"""



				if not s:
								return "\n" + width * char
				__lowercase			,     __lowercase 			=							divmod(width - len(lowercase							) - 2							,			2							)
				return F"{left * char} {s} {(left + extra) * char}"


if __name__ == "__main__":
		import doctest

		doctest.testmod()
		print(prompt("""Binary Tree Traversals"""))

		__a  :     TreeNode       =  build_tree()
		print(prompt("""Pre Order Traversal"""))
		pre_order(node)
		print(prompt() + """\n""")

		print(prompt("""In Order Traversal"""))
		in_order(node)
		print(prompt() + """\n""")

		print(prompt("""Post Order Traversal"""))
		post_order(node)
		print(prompt() + """\n""")

		print(prompt("""Level Order Traversal"""))
		level_order(node)
		print(prompt() + """\n""")

		print(prompt("""Actual Level Order Traversal"""))
		level_order_actual(node)
		print("""*""" * 5_0 + """\n""")

		print(prompt("""Pre Order Traversal - Iteration Version"""))
		pre_order_iter(node)
		print(prompt() + """\n""")

		print(prompt("""In Order Traversal - Iteration Version"""))
		in_order_iter(node)
		print(prompt() + """\n""")

		print(prompt("""Post Order Traversal - Iteration Version"""))
		post_order_iter(node)
		print(prompt())
import requests





def 				UpperCAmelCase						(    lowercase							,			lowercase							):







				"""simple docstring"""



				__lowercase 			=							{'''Content-Type''': '''application/json'''}
				__lowercase 			=							requests.post(lowercase							,			json={'''text''': message_body}							,			headers=lowercase							)
				if response.status_code != 200:
								__lowercase 			=							(
								    '''Request to slack returned an error '''
								    F"{response.status_code}, the response is:\n{response.text}"
								)
								raise ValueError(lowercase							)


if __name__ == "__main__":
		# Set the slack url to the one provided by Slack when you create the webhook at
		# https://my.slack.com/services/new/incoming-webhook/
		send_slack_message("""<YOUR MESSAGE BODY>""", """<SLACK CHANNEL URL>""")