<jupyter_start><jupyter_text><jupyter_code>class Graph:
	
	def __init__(self, V):
		
		self.V = V
		self.g = [[0 for j in range(self.V + 1)]
					for i in range(self.V + 1)]
		for i in range(self.V + 1):
			self.g[i][i] = 1

	# Function to add edge between nodes
	def addEdge(self, u, v):

		self.g[u][v] = 1
		self.g[v][u] = 1

	# Function to compute the path
	def computePaths(self):

		# Use Floyd Warshall algorithm
		# to detect if a path exists
		for k in range(1, self.V + 1):

			# Try every vertex as an
			# intermediate vertex
			# to check if a path exists
			for i in range(1, self.V + 1):
				for j in range(1, self.V + 1):
					self.g[i][j] = (self.g[i][j] |
								(self.g[i][k] and
									self.g[k][j]))
					
	# Function to check if nodes
	# are reachable
	def isReachable(self, s, d):

		if (self.g[s][d] == 1):
			return True
		else:
			return False
		
# Driver code
if __name__=='__main__':

    n, m = map(int, input().split())
    _g = Graph(n)
    for i in range(m):
        u, v = map(int, input().split())
        _g.addEdge(u, v)
    
    _g.computePaths()

    _u, _v = map(int, input().split())
	
    if (_g.isReachable(_u, _v)):
        print(1)
    else:
        print(0)<jupyter_output>4 2
1 2
3 2
1 2
1
{'fraction_non_alphanumeric': 0.15347334410339256, 'fraction_numerical': 0.020193861066235864, 'mean_word_length': 2.348648648648649, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '337959', 'license': 'Unlicense', 'n_tokens_mistral': 584, 'n_tokens_neox': 494, 'n_words': 151, 'path': 'Lab12_1.ipynb', 'repo_name': 'hocthucv/bt', 'size': '1238'}