





'''simple docstring'''






# Author: OMKAR PATHAK, Nwachukwu Chidiebere

# Use a Python dictionary to construct the graph.
from __future__ import annotations

from pprint import pformat
from typing import Generic, TypeVar

A   : Tuple             =			TypeVar('T')







class 			lowerCamelCase					(						Generic[T]  ):


					def __init__(					self	:  List[Any]       ,     __snake_case	:  bool = True       ):





											'''simple docstring'''





											_snake_case:   dict[T, list[T]]  					=		{}  # dictionary of lists
											_snake_case:   Dict  					=		directed


					def    SCREAMING_SNAKE_CASE_		(					self	:  Dict       ,     __snake_case	:  T       ,     __snake_case	:  T       ):





											'''simple docstring'''





											if not self.directed:  # For undirected graphs
																	# if both source vertex and destination vertex are both present in the
																	# adjacency list, add destination vertex to source vertex list of adjacent
																	# vertices and add source vertex to destination vertex list of adjacent
																	# vertices.
																	if source_vertex in self.adj_list and destination_vertex in self.adj_list:
																							self.adj_list[source_vertex].append(__snake_case       )
																							self.adj_list[destination_vertex].append(__snake_case       )
																	# if only source vertex is present in adjacency list, add destination vertex
																	# to source vertex list of adjacent vertices, then create a new vertex with
																	# destination vertex as key and assign a list containing the source vertex
																	# as it's first adjacent vertex.
																	elif source_vertex in self.adj_list:
																							self.adj_list[source_vertex].append(__snake_case       )
																							_snake_case:   Optional[int]  					=		[source_vertex]
																	# if only destination vertex is present in adjacency list, add source vertex
																	# to destination vertex list of adjacent vertices, then create a new vertex
																	# with source vertex as key and assign a list containing the source vertex
																	# as it's first adjacent vertex.
																	elif destination_vertex in self.adj_list:
																							self.adj_list[destination_vertex].append(__snake_case       )
																							_snake_case:   Dict  					=		[destination_vertex]
																	# if both source vertex and destination vertex are not present in adjacency
																	# list, create a new vertex with source vertex as key and assign a list
																	# containing the destination vertex as it's first adjacent vertex also
																	# create a new vertex with destination vertex as key and assign a list
																	# containing the source vertex as it's first adjacent vertex.
																	else:
																							_snake_case:   Dict  					=		[destination_vertex]
																							_snake_case:   Tuple  					=		[source_vertex]
											else:  # For directed graphs
																	# if both source vertex and destination vertex are present in adjacency
																	# list, add destination vertex to source vertex list of adjacent vertices.
																	if source_vertex in self.adj_list and destination_vertex in self.adj_list:
																							self.adj_list[source_vertex].append(__snake_case       )
																	# if only source vertex is present in adjacency list, add destination
																	# vertex to source vertex list of adjacent vertices and create a new vertex
																	# with destination vertex as key, which has no adjacent vertex
																	elif source_vertex in self.adj_list:
																							self.adj_list[source_vertex].append(__snake_case       )
																							_snake_case:   Dict  					=		[]
																	# if only destination vertex is present in adjacency list, create a new
																	# vertex with source vertex as key and assign a list containing destination
																	# vertex as first adjacent vertex
																	elif destination_vertex in self.adj_list:
																							_snake_case:   Tuple  					=		[destination_vertex]
																	# if both source vertex and destination vertex are not present in adjacency
																	# list, create a new vertex with source vertex as key and a list containing
																	# destination vertex as it's first adjacent vertex. Then create a new vertex
																	# with destination vertex as key, which has no adjacent vertex
																	else:
																							_snake_case:   Optional[Any]  					=		[destination_vertex]
																							_snake_case:   Any  					=		[]

											return self




					def __repr__(					self	:  Tuple       ):





											'''simple docstring'''





											return pformat(self.adj_list       )












'''simple docstring'''






import sys
import webbrowser

import requests
from bsa import BeautifulSoup
from fake_useragent import UserAgent

if __name__ == "__main__":
		print('Googling.....')
		A   : Optional[int]             =			'https://www.google.com/search?q=' + ' '.join(sys.argv[1:])
		A   : Dict             =			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(10_000):
						out_file.write(data)
		A   : List[Any]             =			BeautifulSoup(res.text, 'html.parser')
		A   : List[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")}')





