from collections.abc import Sequence
from queue import Queue




class   _UpperCamelCase :


			"""simple docstring"""






			def __init__(  self ,  lowerCAmelCase__ ,  lowerCAmelCase__ ,  lowerCAmelCase__ ,  lowerCAmelCase__=None ,  lowerCAmelCase__=None		)	->   Tuple:

							'''simple docstring'''


							__lowercase					     =				start
							__lowercase					     =				end
							__lowercase					     =				val
							__lowercase					     =				(start + end) // 2
							__lowercase					     =				left
							__lowercase					     =				right





			def __repr__(  self		)	->   str:

							'''simple docstring'''


							return F"SegmentTreeNode(start={self.start}, end={self.end}, val={self.val})"




class   _UpperCamelCase :


			"""simple docstring"""






			def __init__(  self ,  lowerCAmelCase__ ,  lowerCAmelCase__		)	->   int:

							'''simple docstring'''


							__lowercase					     =				collection
							__lowercase					     =				function
							if self.collection:
											__lowercase					     =				self._build_tree(0 ,  len(lowerCAmelCase__		) - 1		)





			def 			_SCREAMING_SNAKE_CASE     (  self ,  lowerCAmelCase__ ,  lowerCAmelCase__		)	->   Any:

							'''simple docstring'''


							self._update_tree(self.root ,  lowerCAmelCase__ ,  lowerCAmelCase__		)





			def 			_SCREAMING_SNAKE_CASE     (  self ,  lowerCAmelCase__ ,  lowerCAmelCase__		)	->   Dict:

							'''simple docstring'''


							return self._query_range(self.root ,  lowerCAmelCase__ ,  lowerCAmelCase__		)





			def 			_SCREAMING_SNAKE_CASE     (  self ,  lowerCAmelCase__ ,  lowerCAmelCase__		)	->   int:

							'''simple docstring'''


							if start == end:
											return SegmentTreeNode(lowerCAmelCase__ ,  lowerCAmelCase__ ,  self.collection[start]		)
							__lowercase					     =				(start + end) // 2
							__lowercase					     =				self._build_tree(lowerCAmelCase__ ,  lowerCAmelCase__		)
							__lowercase					     =				self._build_tree(mid + 1 ,  lowerCAmelCase__		)
							return SegmentTreeNode(lowerCAmelCase__ ,  lowerCAmelCase__ ,  self.fn(left.val ,  right.val		) ,  lowerCAmelCase__ ,  lowerCAmelCase__		)





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

							'''simple docstring'''


							if node.start == i and node.end == i:
											__lowercase					     =				val
											return
							if i <= node.mid:
											self._update_tree(node.left ,  lowerCAmelCase__ ,  lowerCAmelCase__		)
							else:
											self._update_tree(node.right ,  lowerCAmelCase__ ,  lowerCAmelCase__		)
							__lowercase					     =				self.fn(node.left.val ,  node.right.val		)





			def 			_SCREAMING_SNAKE_CASE     (  self ,  lowerCAmelCase__ ,  lowerCAmelCase__ ,  lowerCAmelCase__		)	->   Optional[int]:

							'''simple docstring'''


							if node.start == i and node.end == j:
											return node.val

							if i <= node.mid:
											if j <= node.mid:
															# range in left child tree
															return self._query_range(node.left ,  lowerCAmelCase__ ,  lowerCAmelCase__		)
											else:
															# range in left child tree and right child tree
															return self.fn(
															    self._query_range(node.left ,  lowerCAmelCase__ ,  node.mid		) ,  self._query_range(node.right ,  node.mid + 1 ,  lowerCAmelCase__		) ,  )
							else:
											# range in right child tree
											return self._query_range(node.right ,  lowerCAmelCase__ ,  lowerCAmelCase__		)





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

							'''simple docstring'''


							if self.root is not None:
											__lowercase					     =				Queue()
											queue.put(self.root		)
											while not queue.empty():
															__lowercase					     =				queue.get()
															yield node

															if node.left is not None:
																			queue.put(node.left		)

															if node.right is not None:
																			queue.put(node.right		)


if __name__ == "__main__":
		import operator

		for fn in [operator.add, max, min]:
				print("""*""" * 5_0)
				__a    :	List[Any]         =    SegmentTree([2, 1, 5, 3, 4], fn)
				for node in arr.traverse():
						print(node)
				print()

				arr.update(1, 5)
				for node in arr.traverse():
						print(node)
				print()

				print(arr.query_range(3, 4))  # 7
				print(arr.query_range(2, 2))  # 5
				print(arr.query_range(1, 3))  # 13
				print()
import sys
import webbrowser

import requests
from bsa import BeautifulSoup
from fake_useragent import UserAgent

if __name__ == "__main__":
		print("""Googling.....""")
		__a    :	Tuple         =    """https://www.google.com/search?q=""" + """ """.join(sys.argv[1:])
		__a    :	List[str]         =    requests.get(url, headers={"""UserAgent""": UserAgent().random})
		# res.raise_for_status()
		with open("""project1a.html""", """wb""") as out_file:  # only for knowing the class
				for data in res.iter_content(1_0_0_0_0):
						out_file.write(data)
		__a    :	Dict         =    BeautifulSoup(res.text, """html.parser""")
		__a    :	Any         =    list(soup.select(""".eZt8xd"""))[:5]

		print(len(links))
		for link in links:
				if link.text == "Maps":
						webbrowser.open(link.get("""href"""))
				else:
						webbrowser.open(F'''https://google.com{link.get("href")}''')