





"""simple docstring"""






from __future__ import annotations

from collections import deque
from collections.abc import Sequence
from dataclasses import dataclass
from typing import Any




@dataclass
class 				__lowercase			:







					'''simple docstring'''




					__lowerCAmelCase  =  42
					__lowerCAmelCase  =  None
					__lowerCAmelCase  =  None






def     __A      (			)		->		Node | None:
				__a :						str			       =  Node(1)
				__a :						Optional[int]			       =  Node(2)
				__a :						Optional[int]			       =  Node(3)
				__a :						Optional[int]			       =  Node(4)
				__a :						Optional[int]			       =  Node(5)
				return tree

def     __A      (			a_						:Node | None)		->		list[int]:
				return [root.data, *preorder(root.left), *preorder(root.right)] if root else []

def     __A      (			a_						:Node | None)		->		list[int]:
				return postorder(root.left) + postorder(root.right) + [root.data] if root else []

def     __A      (			a_						:Node | None)		->		list[int]:
				return [*inorder(root.left), root.data, *inorder(root.right)] if root else []

def     __A      (			a_						:Node | None)		->		int:
				return (max(height(root.left)   ,       height(root.right)) + 1) if root else 0

def     __A      (			a_						:Node | None)		->		Sequence[Node | None]:
				__a :						list[Any]			       =  []

				if root is None:
								return output

				__a :						Optional[int]			       =  deque([root])

				while process_queue:
								__a :						Tuple			       =  process_queue.popleft()
								output.append(node.data)

								if node.left:
												process_queue.append(node.left)
								if node.right:
												process_queue.append(node.right)
				return output

def     __A      (			a_						:Node | None   ,       a_						:int)		->		Sequence[Node | None]:
				__a :						list[Any]			       =  []

				def populate_output(a_						:Node | None   ,       a_						:int) -> None:
								if not root:
												return
								if level == 1:
												output.append(root.data)
								elif level > 1:
												populate_output(root.left   ,       level - 1)
												populate_output(root.right   ,       level - 1)

				populate_output(a_   ,       a_)
				return output

def     __A      (			a_						:Node | None   ,       a_						:int)		->		Sequence[Node | None]:
				__a :						list[Any]			       =  []

				def populate_output(a_						:Node | None   ,       a_						:int) -> None:
								if root is None:
												return
								if level == 1:
												output.append(root.data)
								elif level > 1:
												populate_output(root.right   ,       level - 1)
												populate_output(root.left   ,       level - 1)

				populate_output(a_   ,       a_)
				return output

def     __A      (			a_						:Node | None)		->		Sequence[Node | None] | list[Any]:
				if root is None:
								return []

				__a :						list[Sequence[Node | None]]			       =  []

				__a :						List[Any]			       =  0
				__a :						List[str]			       =  height(a_)

				for h in range(1   ,       height_tree + 1):
								if not flag:
												output.append(get_nodes_from_left_to_right(a_   ,       a_))
												__a :						Any			       =  1
								else:
												output.append(get_nodes_from_right_to_left(a_   ,       a_))
												__a :						Optional[Any]			       =  0

				return output

def     __A      (			)		->		None:  # Main function for testing.
				__a :						List[str]			       =  make_tree()
				print(F"""In-order Traversal: {inorder(a_)}""")
				print(F"""Pre-order Traversal: {preorder(a_)}""")
				print(F"""Post-order Traversal: {postorder(a_)}"""   ,       '''\n''')

				print(F"""Height of Tree: {height(a_)}"""   ,       '''\n''')

				print('''Complete Level Order Traversal: ''')
				print(level_order(a_)   ,       '''\n''')

				print('''Level-wise order Traversal: ''')

				for level in range(1   ,       height(a_) + 1):
								print(F"""Level {level}:"""   ,       get_nodes_from_left_to_right(a_   ,       level=a_))

				print('''\nZigZag order Traversal: ''')
				print(zigzag(a_))


if __name__ == "__main__":
		import doctest

		doctest.testmod()
		main()






"""simple docstring"""






from __future__ import annotations

import typing
from collections import Counter

def     __A      (			a_						:int)		->		typing.Counter[int]:
				__a :						typing.Counter[int]			       =  Counter()
				for base in range(1   ,       max_perimeter + 1):
								for perpendicular in range(a_   ,       max_perimeter + 1):
												__a :						Any			       =  (base * base + perpendicular * perpendicular) ** 0.5
												if hypotenuse == int(a_):
																__a :						List[Any]			       =  int(base + perpendicular + hypotenuse)
																if perimeter > max_perimeter:
																				continue
																triplets[perimeter] += 1
				return triplets

def     __A      (			a_						:int = 10_00)		->		int:
				__a :						Dict			       =  pythagorean_triple(a_)
				return triplets.most_common(1)[0][0]


if __name__ == "__main__":
		print(F'Perimeter {solution()} has maximum solutions')