





from collections import deque





def lowerCAmelCase__(__snake_case							)    ->				str:







	'''simple docstring'''







	return input(__snake_case							).strip().split(''' '''							)





def lowerCAmelCase__(__snake_case	,__snake_case							)    ->				dict[int, list[int]]:







	'''simple docstring'''







	lowerCamelCase__        =		{}
	for i in range(__snake_case							):
		lowerCamelCase__        =		[]

	for e in range(__snake_case							):
		lowerCamelCase__    ,     lowerCamelCase__        =		(int(__snake_case							) for i in _input(F'Edge {e + 1}: <node1> <node2> '							))
		graph[x].append(__snake_case							)
	return graph





def lowerCAmelCase__(__snake_case	,__snake_case							)    ->				dict[int, list[int]]:







	'''simple docstring'''







	lowerCamelCase__        =		{}
	for i in range(__snake_case							):
		lowerCamelCase__        =		[]

	for e in range(__snake_case							):
		lowerCamelCase__    ,     lowerCamelCase__        =		(int(__snake_case							) for i in _input(F'Edge {e + 1}: <node1> <node2> '							))
		graph[x].append(__snake_case							)
		graph[y].append(__snake_case							)
	return graph





def lowerCAmelCase__(__snake_case	,__snake_case							)    ->				dict[int, list[tuple[int, int]]]:







	'''simple docstring'''







	lowerCamelCase__        =		{}
	for i in range(__snake_case							):
		lowerCamelCase__        =		[]

	for e in range(__snake_case							):
		lowerCamelCase__    ,     lowerCamelCase__    ,     lowerCamelCase__        =		(int(__snake_case							) for i in _input(F'Edge {e + 1}: <node1> <node2> <weight> '							))
		graph[x].append((y, w)							)
		graph[y].append((x, w)							)
	return graph


if __name__ == "__main__":
			_a						,		_a									=				(int(i) for i in _input("Number of nodes and edges: "))

			_a									=				int(
			    _input(
			        "Press 1 or 2 or 3 \n"
			        "1. Unweighted directed \n"
			        "2. Unweighted undirected \n"
			        "3. Weighted undirected \n"
			    )[0]
			)

			_a									=				{
			    1: initialize_unweighted_directed_graph,
			    2: initialize_unweighted_undirected_graph,
			    3: initialize_weighted_undirected_graph,
			}[graph_choice](n, m)





def lowerCAmelCase__(__snake_case	,__snake_case							)    ->				Dict:







	'''simple docstring'''







	lowerCamelCase__    ,     lowerCamelCase__        =		{s}, [s]
	print(__snake_case							)
	while _s:
		lowerCamelCase__        =		0
		for i in g[_s[-1]]:
			if i not in vis:
				_s.append(__snake_case							)
				vis.add(__snake_case							)
				lowerCamelCase__        =		1
				print(__snake_case							)
				break
		if not flag:
			_s.pop()





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







	'''simple docstring'''







	lowerCamelCase__    ,     lowerCamelCase__        =		{s}, deque([s]							)
	print(__snake_case							)
	while q:
		lowerCamelCase__        =		q.popleft()
		for v in g[u]:
			if v not in vis:
				vis.add(__snake_case							)
				q.append(__snake_case							)
				print(__snake_case							)





def lowerCAmelCase__(__snake_case	,__snake_case							)    ->				List[str]:







	'''simple docstring'''







	lowerCamelCase__    ,     lowerCamelCase__    ,     lowerCamelCase__        =		{s: 0}, set(), {s: 0}
	while True:
		if len(__snake_case							) == len(__snake_case							) - 1:
			break
		lowerCamelCase__        =		100000
		for i in dist:
			if i not in known and dist[i] < mini:
				lowerCamelCase__        =		dist[i]
				lowerCamelCase__        =		i
		known.add(__snake_case							)
		for v in g[u]:
			if v[0] not in known and dist[u] + v[1] < dist.get(v[0]	,100000							):
				lowerCamelCase__        =		dist[u] + v[1]
				lowerCamelCase__        =		u
	for i in dist:
		if i != s:
			print(dist[i]							)





def lowerCAmelCase__(__snake_case	,__snake_case=None	,__snake_case=None							)    ->				int:







	'''simple docstring'''







	if q is None:
		lowerCamelCase__        =		[1]
	if ind is None:
		lowerCamelCase__        =		[0] * (len(__snake_case							) + 1)  # SInce oth Index is ignored
		for u in g:
			for v in g[u]:
				ind[v] += 1
		lowerCamelCase__        =		deque()
		for i in g:
			if ind[i] == 0:
				q.append(__snake_case							)
	if len(__snake_case							) == 0:
		return
	lowerCamelCase__        =		q.popleft()
	print(__snake_case							)
	for w in g[v]:
		ind[w] -= 1
		if ind[w] == 0:
			q.append(__snake_case							)
	topo(__snake_case	,__snake_case	,__snake_case							)





def lowerCAmelCase__()    ->				Dict:







	'''simple docstring'''







	lowerCamelCase__        =		input().strip()
	lowerCamelCase__        =		[]
	for _ in range(__snake_case							):
		a.append(map(__snake_case	,input().strip().split()							)							)
	return a, n





def lowerCAmelCase__(__snake_case							)    ->				Optional[int]:







	'''simple docstring'''







	((lowerCamelCase__)    ,     (lowerCamelCase__))        =		a_and_n
	lowerCamelCase__        =		list(__snake_case							)
	lowerCamelCase__        =		[[0] * n for i in range(__snake_case							)]
	for k in range(__snake_case							):
		for i in range(__snake_case							):
			for j in range(__snake_case							):
				if dist[i][j] > dist[i][k] + dist[k][j]:
					lowerCamelCase__        =		dist[i][k] + dist[k][j]
					lowerCamelCase__        =		k
	print(__snake_case							)





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







	'''simple docstring'''







	lowerCamelCase__    ,     lowerCamelCase__    ,     lowerCamelCase__        =		{s: 0}, set(), {s: 0}
	while True:
		if len(__snake_case							) == len(__snake_case							) - 1:
			break
		lowerCamelCase__        =		100000
		for i in dist:
			if i not in known and dist[i] < mini:
				lowerCamelCase__        =		dist[i]
				lowerCamelCase__        =		i
		known.add(__snake_case							)
		for v in g[u]:
			if v[0] not in known and v[1] < dist.get(v[0]	,100000							):
				lowerCamelCase__        =		v[1]
				lowerCamelCase__        =		u
	return dist





def lowerCAmelCase__()    ->				Any:







	'''simple docstring'''







	lowerCamelCase__    ,     lowerCamelCase__        =		map(__snake_case	,input().split(''' '''							)							)
	lowerCamelCase__        =		[]
	for _ in range(__snake_case							):
		edges.append(map(__snake_case	,input().split(''' '''							)							)							)
	return edges, n





def lowerCAmelCase__(__snake_case							)    ->				Any:







	'''simple docstring'''







	((lowerCamelCase__)    ,     (lowerCamelCase__))        =		e_and_n
	e.sort(reverse=__snake_case	,key=lambda __snake_case							: x[2]							)
	lowerCamelCase__        =		[{i} for i in range(1	,n + 1							)]
	while True:
		if len(__snake_case							) == 1:
			break
		print(__snake_case							)
		lowerCamelCase__        =		e.pop()
		for i in range(len(__snake_case							)							):
			if x[0] in s[i]:
				break
		for j in range(len(__snake_case							)							):
			if x[1] in s[j]:
				if i == j:
					break
				s[j].update(s[i]							)
				s.pop(__snake_case							)
				break





def lowerCAmelCase__(__snake_case							)    ->				str:







	'''simple docstring'''







	lowerCamelCase__        =		[]
	for node in graph:
		if not graph[node]:
			isolated.append(__snake_case							)
	return isolated













import warnings

from .generation import FlaxGenerationMixin






class  __A   (   lowerCAmelCase			):

			'''simple docstring'''







			warnings.warn(
			    """Importing `FlaxGenerationMixin` from `src/transformers/generation_flax_utils.py` is deprecated and will """
			    """be removed in Transformers v5. Import as `from transformers import FlaxGenerationMixin` instead."""      ,    lowerCAmelCase      ,    )



