




"""simple docstring"""






class lowerCAmelCase__	:






			'''simple docstring'''



			def __init__(  self  ):
							_lowerCamelCase     :			Tuple    =    0
							_lowerCamelCase     :			Any    =    0
							_lowerCamelCase     :			int    =    {}
			def 					A_    (  self  ,      lowercase  ):
							if vertex not in self.adjacency:
											_lowerCamelCase     :			Optional[Any]    =    {}
											self.num_vertices += 1
			def 					A_    (  self  ,      lowercase  ,      lowercase  ,      lowercase  ):
							self.add_vertex(lowercase  )
							self.add_vertex(lowercase  )

							if head == tail:
											return

							_lowerCamelCase     :			Optional[int]    =    weight
							_lowerCamelCase     :			Optional[int]    =    weight
			def 					A_    (  self  ):
							_lowerCamelCase     :			Optional[Any]    =    self.get_edges()
							for edge in edges:
											_lowerCamelCase, _lowerCamelCase, _lowerCamelCase     :			Tuple    =    edge
											edges.remove((tail, head, weight)  )
							for i in range(len(lowercase  )  ):
											_lowerCamelCase     :			Any    =    list(edges[i]  )

							edges.sort(key=lambda lowercase  : e[2]  )
							for i in range(len(lowercase  ) - 1  ):
											if edges[i][2] >= edges[i + 1][2]:
															_lowerCamelCase     :			Dict    =    edges[i][2] + 1
							for edge in edges:
											_lowerCamelCase, _lowerCamelCase, _lowerCamelCase     :			List[str]    =    edge
											_lowerCamelCase     :			int    =    weight
											_lowerCamelCase     :			Dict    =    weight
			def __str__(  self  ):
							_lowerCamelCase     :			Tuple    =    ''
							for tail in self.adjacency:
											for head in self.adjacency[tail]:
															_lowerCamelCase     :			Optional[Any]    =    self.adjacency[head][tail]
															string += F'''{head} -> {tail} == {weight}\n'''
							return string.rstrip('\n'  )
			def 					A_    (  self  ):
							_lowerCamelCase     :			List[str]    =    []
							for tail in self.adjacency:
											for head in self.adjacency[tail]:
															output.append((tail, head, self.adjacency[head][tail])  )
							return output
			def 					A_    (  self  ):
							return self.adjacency.keys()
			@staticmethod
			def 					A_    (  lowercase=None  ,      lowercase=None  ):
							_lowerCamelCase     :			List[str]    =    Graph()
							if vertices is None:
											_lowerCamelCase     :			Optional[Any]    =    []
							if edges is None:
											_lowerCamelCase     :			Dict    =    []
							for vertex in vertices:
											g.add_vertex(lowercase  )
							for edge in edges:
											g.add_edge(*lowercase  )
							return g






			class lowerCAmelCase__	:






						'''simple docstring'''



						def __init__(  self  ):
										_lowerCamelCase     :			Dict    =    {}
										_lowerCamelCase     :			List[str]    =    {}
						def __len__(  self  ):
										return len(self.parent  )
						def 					A_    (  self  ,      lowercase  ):
										if item in self.parent:
														return self.find(lowercase  )

										_lowerCamelCase     :			str    =    item
										_lowerCamelCase     :			int    =    0
										return item
						def 					A_    (  self  ,      lowercase  ):
										if item not in self.parent:
														return self.make_set(lowercase  )
										if item != self.parent[item]:
														_lowerCamelCase     :			Tuple    =    self.find(self.parent[item]  )
										return self.parent[item]






						def 					A_    (  self  ,      lowercase  ,      lowercase  ):
										_lowerCamelCase     :			int    =    self.find(lowercase  )
										_lowerCamelCase     :			Union[str, Any]    =    self.find(lowercase  )

										if roota == roota:
														return roota

										if self.rank[roota] > self.rank[roota]:
														_lowerCamelCase     :			int    =    roota
														return roota

										if self.rank[roota] < self.rank[roota]:
														_lowerCamelCase     :			Any    =    roota
														return roota

										if self.rank[roota] == self.rank[roota]:
														self.rank[roota] += 1
														_lowerCamelCase     :			Optional[int]    =    roota
														return roota
										return None

			@staticmethod
			def 					A_    (  lowercase  ):
							_lowerCamelCase     :			str    =    graph.num_vertices

							_lowerCamelCase     :			str    =    Graph.UnionFind()
							_lowerCamelCase     :			Dict    =    []
							while num_components > 1:
											_lowerCamelCase     :			Dict    =    {}
											for vertex in graph.get_vertices():
															_lowerCamelCase     :			Optional[Any]    =    -1

											_lowerCamelCase     :			List[str]    =    graph.get_edges()
											for edge in edges:
															_lowerCamelCase, _lowerCamelCase, _lowerCamelCase     :			Optional[Any]    =    edge
															edges.remove((tail, head, weight)  )
											for edge in edges:
															_lowerCamelCase, _lowerCamelCase, _lowerCamelCase     :			Optional[int]    =    edge
															_lowerCamelCase     :			Optional[int]    =    union_find.find(lowercase  )
															_lowerCamelCase     :			str    =    union_find.find(lowercase  )
															if seta != seta:
																			if cheap_edge[seta] == -1 or cheap_edge[seta][2] > weight:
																							_lowerCamelCase     :			int    =    [head, tail, weight]

																			if cheap_edge[seta] == -1 or cheap_edge[seta][2] > weight:
																							_lowerCamelCase     :			Any    =    [head, tail, weight]
											for vertex in cheap_edge:
															if cheap_edge[vertex] != -1:
																			_lowerCamelCase, _lowerCamelCase, _lowerCamelCase     :			Optional[Any]    =    cheap_edge[vertex]
																			if union_find.find(lowercase  ) != union_find.find(lowercase  ):
																							union_find.union(lowercase  ,      lowercase  )
																							mst_edges.append(cheap_edge[vertex]  )
																							_lowerCamelCase     :			Dict    =    num_components - 1
							_lowerCamelCase     :			int    =    Graph.build(edges=lowercase  )
							return mst





"""simple docstring"""






import socket







def      _snake_case			(				):
				_lowerCamelCase     :			List[Any]    =    socket.socket(socket.AF_INET							,    socket.SOCK_STREAM		)
				_lowerCamelCase     :			Union[str, Any]    =    socket.gethostname()
				_lowerCamelCase     :			List[Any]    =    12312

				sock.connect((host, port)		)
				sock.send(B'Hello server!'		)

				with open('Received_file'							,    'wb'		) as out_file:
								print('File opened'		)
								print('Receiving data...'		)
								while True:
												_lowerCamelCase     :			int    =    sock.recv(1024		)
												if not data:
																break
												out_file.write(lowercase__		)

				print('Successfully received the file'		)
				sock.close()
				print('Connection closed'		)


if __name__ == "__main__":
			main()