



class      __lowerCAmelCase     :  # Public class to implement a graph
					"""simple docstring"""






					def __init__(     self					:       Optional[Any]				,					_snake_case					:       int				,					_snake_case					:       int				,					_snake_case					:       list[list[bool]]					):






								"""simple docstring"""


								A__       =    row
								A__       =    col
								A__       =    graph



					def     _a							(     self					:       Optional[Any]				,					_snake_case					:       int				,					_snake_case					:       int				,					_snake_case					:       list[list[bool]]					):






								"""simple docstring"""


								return (
								    0 <= i < self.ROW
								    and 0 <= j < self.COL
								    and not visited[i][j]
								    and self.graph[i][j]
								)



					def     _a							(     self					:       int				,					_snake_case					:       int				,					_snake_case					:       int				,					_snake_case					:       list[list[bool]]					):






								"""simple docstring"""


								A__       =    [-1, -1, -1, 0, 0, 1, 1, 1]  # Coordinate order
								A__       =    [-1, 0, 1, -1, 1, -1, 0, 1]
								A__       =    True  # Make those cells visited
								for k in range(8					):
											if self.is_safe(i + row_nbr[k]				,					j + col_nbr[k]				,					UpperCamelCase_					):
														self.diffs(i + row_nbr[k]				,					j + col_nbr[k]				,					UpperCamelCase_					)



					def     _a							(     self					:       Optional[int]					):  # And finally, count all islands.






								"""simple docstring"""


								A__       =    [[False for j in range(self.COL					)] for i in range(self.ROW					)]
								A__       =    0
								for i in range(self.ROW					):
											for j in range(self.COL					):
														if visited[i][j] is False and self.graph[i][j] == 1:
																	self.diffs(UpperCamelCase_				,					UpperCamelCase_				,					UpperCamelCase_					)
																	count += 1
								return count











import webbrowser
from sys import argv
from urllib.parse import parse_qs, quote

import requests
from bsa import BeautifulSoup
from fake_useragent import UserAgent

if __name__ == "__main__":
							SCREAMING_SNAKE_CASE__       =      '''%20'''.join(argv[1:]) if len(argv) > 1 else quote(str(input('''Search: ''')))

							print('''Googling.....''')

							SCREAMING_SNAKE_CASE__       =      f'https://www.google.com/search?q={query}&num=100'

							SCREAMING_SNAKE_CASE__       =      requests.get(
							    url,
							    headers={'''User-Agent''': str(UserAgent().random)},
							)

							try:
														SCREAMING_SNAKE_CASE__       =      (
														    BeautifulSoup(res.text, '''html.parser''')
														    .find('''div''', attrs={'''class''': '''yuRUbf'''})
														    .find('''a''')
														    .get('''href''')
														)

							except AttributeError:
														SCREAMING_SNAKE_CASE__       =      parse_qs(
														    BeautifulSoup(res.text, '''html.parser''')
														    .find('''div''', attrs={'''class''': '''kCrYT'''})
														    .find('''a''')
														    .get('''href''')
														)['''url'''][0]

							webbrowser.open(link)




