

from collections import deque


def 				_a       (				lowerCAmelCase   )->  List[Any]:
		return input(__lowerCamelCase   ).strip().split(' '   )


def 				_a       (				lowerCAmelCase						,	lowerCAmelCase   )->  dict[int, list[int]]:
		SCREAMING_SNAKE_CASE_							=       {}
		for i in range(__lowerCamelCase   ):
				SCREAMING_SNAKE_CASE_							=       []

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


def 				_a       (				lowerCAmelCase						,	lowerCAmelCase   )->  dict[int, list[int]]:
		SCREAMING_SNAKE_CASE_							=       {}
		for i in range(__lowerCamelCase   ):
				SCREAMING_SNAKE_CASE_							=       []

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


def 				_a       (				lowerCAmelCase						,	lowerCAmelCase   )->  dict[int, list[tuple[int, int]]]:
		SCREAMING_SNAKE_CASE_							=       {}
		for i in range(__lowerCamelCase   ):
				SCREAMING_SNAKE_CASE_							=       []

		for e in range(__lowerCamelCase   ):
				SCREAMING_SNAKE_CASE_							=       (int(__lowerCamelCase   ) 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__":
						SCREAMING_SNAKE_CASE:    Optional[int]											=   (int(i) for i in _input('''Number of nodes and edges: '''))

						SCREAMING_SNAKE_CASE:    Any											=   int(
						    _input(
						        '''Press 1 or 2 or 3 \n'''
						        '''1. Unweighted directed \n'''
						        '''2. Unweighted undirected \n'''
						        '''3. Weighted undirected \n'''
						    )[0]
						)

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


def 				_a       (				lowerCAmelCase						,	lowerCAmelCase   )->  Any:
		SCREAMING_SNAKE_CASE_							=       {s}, [s]
		print(__lowerCamelCase   )
		while _s:
				SCREAMING_SNAKE_CASE_							=       0
				for i in g[_s[-1]]:
						if i not in vis:
								_s.append(__lowerCamelCase   )
								vis.add(__lowerCamelCase   )
								SCREAMING_SNAKE_CASE_							=       1
								print(__lowerCamelCase   )
								break
				if not flag:
						_s.pop()


def 				_a       (				lowerCAmelCase						,	lowerCAmelCase   )->  int:
		SCREAMING_SNAKE_CASE_							=       {s}, deque([s]   )
		print(__lowerCamelCase   )
		while q:
				SCREAMING_SNAKE_CASE_							=       q.popleft()
				for v in g[u]:
						if v not in vis:
								vis.add(__lowerCamelCase   )
								q.append(__lowerCamelCase   )
								print(__lowerCamelCase   )


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


def 				_a       (				lowerCAmelCase						,	lowerCAmelCase=None						,	lowerCAmelCase=None   )->  Union[str, Any]:
		if q is None:
				SCREAMING_SNAKE_CASE_							=       [1]
		if ind is None:
				SCREAMING_SNAKE_CASE_							=       [0] * (len(__lowerCamelCase   ) + 1)  # SInce oth Index is ignored
				for u in g:
						for v in g[u]:
								ind[v] += 1
				SCREAMING_SNAKE_CASE_							=       deque()
				for i in g:
						if ind[i] == 0:
								q.append(__lowerCamelCase   )
		if len(__lowerCamelCase   ) == 0:
				return
		SCREAMING_SNAKE_CASE_							=       q.popleft()
		print(__lowerCamelCase   )
		for w in g[v]:
				ind[w] -= 1
				if ind[w] == 0:
						q.append(__lowerCamelCase   )
		topo(__lowerCamelCase						,	__lowerCamelCase						,	__lowerCamelCase   )


def 				_a       (				)->  str:
		SCREAMING_SNAKE_CASE_							=       input().strip()
		SCREAMING_SNAKE_CASE_							=       []
		for _ in range(__lowerCamelCase   ):
				a.append(map(__lowerCamelCase						,	input().strip().split()   )   )
		return a, n


def 				_a       (				lowerCAmelCase   )->  Tuple:
		(SCREAMING_SNAKE_CASE_)							=       a_and_n
		SCREAMING_SNAKE_CASE_							=       list(__lowerCamelCase   )
		SCREAMING_SNAKE_CASE_							=       [[0] * n for i in range(__lowerCamelCase   )]
		for k in range(__lowerCamelCase   ):
				for i in range(__lowerCamelCase   ):
						for j in range(__lowerCamelCase   ):
								if dist[i][j] > dist[i][k] + dist[k][j]:
										SCREAMING_SNAKE_CASE_							=       dist[i][k] + dist[k][j]
										SCREAMING_SNAKE_CASE_							=       k
		print(__lowerCamelCase   )


def 				_a       (				lowerCAmelCase						,	lowerCAmelCase   )->  Optional[int]:
		SCREAMING_SNAKE_CASE_							=       {s: 0}, set(), {s: 0}
		while True:
				if len(__lowerCamelCase   ) == len(__lowerCamelCase   ) - 1:
						break
				SCREAMING_SNAKE_CASE_							=       100000
				for i in dist:
						if i not in known and dist[i] < mini:
								SCREAMING_SNAKE_CASE_							=       dist[i]
								SCREAMING_SNAKE_CASE_							=       i
				known.add(__lowerCamelCase   )
				for v in g[u]:
						if v[0] not in known and v[1] < dist.get(v[0]						,	100000   ):
								SCREAMING_SNAKE_CASE_							=       v[1]
								SCREAMING_SNAKE_CASE_							=       u
		return dist


def 				_a       (				)->  List[str]:
		SCREAMING_SNAKE_CASE_							=       map(__lowerCamelCase						,	input().split(' '   )   )
		SCREAMING_SNAKE_CASE_							=       []
		for _ in range(__lowerCamelCase   ):
				edges.append(map(__lowerCamelCase						,	input().split(' '   )   )   )
		return edges, n


def 				_a       (				lowerCAmelCase   )->  Optional[int]:
		(SCREAMING_SNAKE_CASE_)							=       e_and_n
		e.sort(reverse=__lowerCamelCase						,	key=lambda lowerCAmelCase   : x[2]   )
		SCREAMING_SNAKE_CASE_							=       [{i} for i in range(1						,	n + 1   )]
		while True:
				if len(__lowerCamelCase   ) == 1:
						break
				print(__lowerCamelCase   )
				SCREAMING_SNAKE_CASE_							=       e.pop()
				for i in range(len(__lowerCamelCase   )   ):
						if x[0] in s[i]:
								break
				for j in range(len(__lowerCamelCase   )   ):
						if x[1] in s[j]:
								if i == j:
										break
								s[j].update(s[i]   )
								s.pop(__lowerCamelCase   )
								break




def 				_a       (				lowerCAmelCase   )->  Union[str, Any]:
		SCREAMING_SNAKE_CASE_							=       []
		for node in graph:
				if not graph[node]:
						isolated.append(__lowerCamelCase   )
		return isolated





SCREAMING_SNAKE_CASE:    Optional[Any]											=   [0.33, 0.44, 0.55, 0.44, 0.33]
SCREAMING_SNAKE_CASE:    int											=   3
SCREAMING_SNAKE_CASE:    str											=   5

# Buffer Space (with Parameters Space)
SCREAMING_SNAKE_CASE:    list[float]											=   []
SCREAMING_SNAKE_CASE:    list[float]											=   []

# Machine Time
SCREAMING_SNAKE_CASE:    str											=   0


def 				_a       (				lowerCAmelCase   )->  int:
		global buffer_space, params_space, machine_time, K, m, t

		# Choosing Dynamical Systems (All)
		for key, value in enumerate(lowerCAmelCase   ):
				# Evolution Parameter
				SCREAMING_SNAKE_CASE_							=       float(seed / value   )

				# Control Theory: Orbit Change
				SCREAMING_SNAKE_CASE_							=       (buffer_space[(key + 1) % m] + e) % 1

				# Control Theory: Trajectory Change
				SCREAMING_SNAKE_CASE_							=       (params_space[key] + e) % 1 + 3

				# Modification (Transition Function) - Jumps
				SCREAMING_SNAKE_CASE_							=       round(float(r * value * (1 - value)   )						,	10   )
				SCREAMING_SNAKE_CASE_							=       r  # Saving to Parameters Space

		# Logistic Map
		assert max(lowerCAmelCase   ) < 1
		assert max(lowerCAmelCase   ) < 4

		# Machine Time
		machine_time += 1


def 				_a       (				)->  int:
		global buffer_space, params_space, machine_time, K, m, t

		# PRNG (Xorshift by George Marsaglia)
		def xorshift(lowerCAmelCase						,	lowerCAmelCase   ):
				x ^= y >> 13
				y ^= x << 17
				x ^= y >> 5
				return x

		# Choosing Dynamical Systems (Increment)
		SCREAMING_SNAKE_CASE_							=       machine_time % m

		# Evolution (Time Length)
		for _ in range(0						,	lowerCAmelCase   ):
				# Variables (Position + Parameters)
				SCREAMING_SNAKE_CASE_							=       params_space[key]
				SCREAMING_SNAKE_CASE_							=       buffer_space[key]

				# Modification (Transition Function) - Flow
				SCREAMING_SNAKE_CASE_							=       round(float(r * value * (1 - value)   )						,	10   )
				SCREAMING_SNAKE_CASE_							=       (machine_time * 0.0_1 + r * 1.0_1) % 1 + 3

		# Choosing Chaotic Data
		SCREAMING_SNAKE_CASE_							=       int(buffer_space[(key + 2) % m] * (10**10)   )
		SCREAMING_SNAKE_CASE_							=       int(buffer_space[(key - 2) % m] * (10**10)   )

		# Machine Time
		machine_time += 1

		return xorshift(lowerCAmelCase						,	lowerCAmelCase   ) % 0xFFFF_FFFF


def 				_a       (				)->  Optional[Any]:
		global buffer_space, params_space, machine_time, K, m, t

		SCREAMING_SNAKE_CASE_							=       K
		SCREAMING_SNAKE_CASE_							=       [0] * m
		SCREAMING_SNAKE_CASE_							=       0


if __name__ == "__main__":
						# Initialization
						reset()

						# Pushing Data (Input)
						import random

						SCREAMING_SNAKE_CASE:    List[Any]											=   random.sample(range(0xff_ff_ff_ff), 1_0_0)
						for chunk in message:
												push(chunk)

						# for controlling
						SCREAMING_SNAKE_CASE:    List[str]											=   ''''''

						# Pulling Data (Output)
						while inp in ("e", "E"):
												print(f"""{format(pull(), '#04x')}""")
												print(buffer_space)
												print(params_space)
												SCREAMING_SNAKE_CASE:    List[Any]											=   input('''(e)exit? ''').strip()