'''simple docstring'''

from typing import TypeVar

from .arrow_dataset import Dataset, _split_by_node_map_style_dataset
from .iterable_dataset import IterableDataset, _split_by_node_iterable_dataset


A_        =   TypeVar("DatasetType", Dataset, IterableDataset)


def 					UpperCAmelCase__      (							_lowerCAmelCase						: DatasetType,			_lowerCAmelCase						: int,			_lowerCAmelCase						: int)						->		DatasetType:



						"""simple docstring"""

						if isinstance(_lowerCAmelCase,			_lowerCAmelCase):
												return _split_by_node_map_style_dataset(_lowerCAmelCase,			rank=_lowerCAmelCase,			world_size=_lowerCAmelCase)
						else:
												return _split_by_node_iterable_dataset(_lowerCAmelCase,			rank=_lowerCAmelCase,			world_size=_lowerCAmelCase)






'''simple docstring'''

from __future__ import annotations


def 					UpperCAmelCase__      (							_lowerCAmelCase						: int)						->		int | None:



						"""simple docstring"""

						for r in range(1,			_lowerCAmelCase):
												snake_case   :					Optional[Any]							=						[]
												for x in range(n - 1):
																		snake_case   :					int							=						pow(_lowerCAmelCase,			_lowerCAmelCase,			_lowerCAmelCase)
																		if val in li:
																								break
																		li.append(_lowerCAmelCase)
												else:
																		return r
						return None


if __name__ == "__main__":
						A_        =   int(input("Enter a prime number q: "))
						A_        =   find_primitive(q)
						if a is None:
												print(f"Cannot find the primitive for the value: {a!r}")
						else:
												A_        =   int(input("Enter private key of A: "))
												A_        =   pow(a, a_private, q)
												A_        =   int(input("Enter private key of B: "))
												A_        =   pow(a, b_private, q)

												A_        =   pow(b_public, a_private, q)
												A_        =   pow(a_public, b_private, q)

												print("The key value generated by A is: ", a_secret)
												print("The key value generated by B is: ", b_secret)





