



'''simple docstring'''





from __future__ import annotations






def 					a(   A :					Dict )	-> str:
					"""simple docstring"""





					global graph, reversed_graph, scc, component, visit, stack
					if visit[u]:
										return
					a        =     True
					for v in graph[u]:
										dfs(A )
					stack.append(A )






def 					a(   A :					str )	-> List[Any]:
					"""simple docstring"""





					global graph, reversed_graph, scc, component, visit, stack
					if visit[u]:
										return
					a        =     True
					component.append(A )
					for v in reversed_graph[u]:
										dfsa(A )






def 					a(   )	-> Union[str, Any]:
					"""simple docstring"""





					global graph, reversed_graph, scc, component, visit, stack
					for i in range(A ):
										dfs(A )
					a        =     [False] * n
					for i in stack[::-1]:
										if visit[i]:
															continue
										a        =     []
										dfsa(A )
										scc.append(A )
					return scc


if __name__ == "__main__":
				# n - no of nodes, m - no of edges
				_lowercase:				Union[str, Any]       =	list(map(int, input().strip().split()))

				_lowercase:				list[list[int]]       =	[[] for _ in range(n)]  # graph
				_lowercase:				list[list[int]]       =	[[] for i in range(n)]  # reversed graph
				# input graph data (edges)
				for _ in range(m):
								_lowercase:				Tuple       =	list(map(int, input().strip().split()))
								graph[u].append(v)
								reversed_graph[v].append(u)

				_lowercase:				list[int]       =	[]
				_lowercase:				list[bool]       =	[False] * n
				_lowercase:				list[int]       =	[]
				_lowercase:				list[int]       =	[]
				print(kosaraju())





# as due to their complexity multi-gpu tests could impact other tests, and to aid debug we have those in a separate module.

import os
import sys

from transformers.testing_utils import TestCasePlus, execute_subprocess_async, get_gpu_count, require_torch_gpu, slow

from .utils import load_json



class 			_lowercase							(     lowerCAmelCase			):





	"""simple docstring"""




	@classmethod
	def   UpperCamelCase_ (cls	):
						"""simple docstring"""

						return cls




	@slow
	@require_torch_gpu
	def   UpperCamelCase_ (self	):
						"""simple docstring"""

						a        =     self.get_auto_remove_tmp_dir()
						a        =     F'''
            --model_name Helsinki-NLP/opus-mt-en-ro
            --save_dir {output_dir}
            --data_dir {self.test_file_dir_str}/test_data/wmt_en_ro
            --num_beams 2
            --task translation
        '''.split()

						# we want this test to run even if there is only one GPU, but if there are more we use them all
						a        =     get_gpu_count()
						a        =     F'''
            -m torch.distributed.launch
            --nproc_per_node={n_gpu}
            {self.test_file_dir}/run_distributed_eval.py
        '''.split()
						a        =     [sys.executable] + distributed_args + args
						execute_subprocess_async(lowerCamelCase_	, env=self.get_env()	)

						a        =     os.path.join(lowerCamelCase_	, "test_bleu.json"	)
						a        =     load_json(lowerCamelCase_	)
						# print(metrics)
						self.assertGreaterEqual(metrics["bleu"]	, 25	)
