


from collections import deque






def 							_lowercase    (		SCREAMING_SNAKE_CASE_   :		Tuple	):





			"""simple docstring"""




			UpperCamelCase         =					len(SCREAMING_SNAKE_CASE_	)
			UpperCamelCase         =					deque()
			UpperCamelCase         =					[False for _ in range(SCREAMING_SNAKE_CASE_	)]
			UpperCamelCase         =					[-1 for _ in range(SCREAMING_SNAKE_CASE_	)]
			UpperCamelCase         =					index_of[:]

			def strong_connect(SCREAMING_SNAKE_CASE_   :		str       ,  SCREAMING_SNAKE_CASE_   :		int       ,  SCREAMING_SNAKE_CASE_   :		Tuple	):
						UpperCamelCase         =					index  # the number when this node is seen
						UpperCamelCase         =					index  # lowest rank node reachable from here
						index += 1
						stack.append(SCREAMING_SNAKE_CASE_	)
						UpperCamelCase         =					True

						for w in g[v]:
									if index_of[w] == -1:
												UpperCamelCase         =					strong_connect(SCREAMING_SNAKE_CASE_       ,  SCREAMING_SNAKE_CASE_       ,  SCREAMING_SNAKE_CASE_	)
												UpperCamelCase         =					(
												    lowlink_of[w] if lowlink_of[w] < lowlink_of[v] else lowlink_of[v]
												)
									elif on_stack[w]:
												UpperCamelCase         =					(
												    lowlink_of[w] if lowlink_of[w] < lowlink_of[v] else lowlink_of[v]
												)

						if lowlink_of[v] == index_of[v]:
									UpperCamelCase         =					[]
									UpperCamelCase         =					stack.pop()
									UpperCamelCase         =					False
									component.append(SCREAMING_SNAKE_CASE_	)
									while w != v:
												UpperCamelCase         =					stack.pop()
												UpperCamelCase         =					False
												component.append(SCREAMING_SNAKE_CASE_	)
									components.append(SCREAMING_SNAKE_CASE_	)
						return index

			UpperCamelCase         =					[]
			for v in range(SCREAMING_SNAKE_CASE_	):
						if index_of[v] == -1:
									strong_connect(SCREAMING_SNAKE_CASE_       ,  0       ,  SCREAMING_SNAKE_CASE_	)

			return components






def 							_lowercase    (		SCREAMING_SNAKE_CASE_   :		Any       ,  SCREAMING_SNAKE_CASE_   :		Optional[int]	):





			"""simple docstring"""




			UpperCamelCase         =					[[] for _ in range(SCREAMING_SNAKE_CASE_	)]
			for u, v in edges:
						g[u].append(SCREAMING_SNAKE_CASE_	)
			return g


if __name__ == "__main__":
			# Test
			__snake_case            =   7
			__snake_case            =   [0, 0, 1, 2, 3, 3, 4, 4, 6]
			__snake_case            =   [1, 3, 2, 0, 1, 4, 5, 6, 5]
			__snake_case            =   [(u, v) for u, v in zip(source, target)]
			__snake_case            =   create_graph(n_vertices, edges)

			assert [[5], [6], [4], [3, 2, 1, 0]] == tarjan(g)








import math
import unittest






def 							_lowercase    (		SCREAMING_SNAKE_CASE_   :		int	):





			"""simple docstring"""




			assert isinstance(SCREAMING_SNAKE_CASE_       ,  SCREAMING_SNAKE_CASE_	) and (
			    number >= 0
			), "'number' must been an int and positive"

			if 1 < number < 4:
						# 2 and 3 are primes
						return True
			elif number < 2 or number % 2 == 0 or number % 3 == 0:
						# Negatives, 0, 1, all even numbers, all multiples of 3 are not primes
						return False

			# All primes number are in format of 6k +/- 1
			for i in range(5       ,  int(math.sqrt(SCREAMING_SNAKE_CASE_	) + 1	)       ,  6	):
						if number % i == 0 or number % (i + 2) == 0:
									return False
			return True




class    UpperCAmelCase					(       unittest.TestCase    ):




			def   lowerCamelCase_					(						self							:		Any						):







						"""simple docstring"""







						self.assertTrue(is_prime(2						)						)
						self.assertTrue(is_prime(3						)						)
						self.assertTrue(is_prime(5						)						)
						self.assertTrue(is_prime(7						)						)
						self.assertTrue(is_prime(1_1						)						)
						self.assertTrue(is_prime(1_3						)						)
						self.assertTrue(is_prime(1_7						)						)
						self.assertTrue(is_prime(1_9						)						)
						self.assertTrue(is_prime(2_3						)						)
						self.assertTrue(is_prime(2_9						)						)





			def   lowerCamelCase_					(						self							:		Dict						):







						"""simple docstring"""







						with self.assertRaises(__magic_name__						):
									is_prime(-1_9						)
						self.assertFalse(
						    is_prime(0						)       ,       """Zero doesn't have any positive factors, primes must have exactly two."""       ,       )
						self.assertFalse(
						    is_prime(1						)       ,       """One only has 1 positive factor, primes must have exactly two."""       ,       )
						self.assertFalse(is_prime(2 * 2						)						)
						self.assertFalse(is_prime(2 * 3						)						)
						self.assertFalse(is_prime(3 * 3						)						)
						self.assertFalse(is_prime(3 * 5						)						)
						self.assertFalse(is_prime(3 * 5 * 7						)						)


if __name__ == "__main__":
			unittest.main()




