



"""simple docstring"""






from __future__ import annotations

from collections.abc import Iterator
from typing import Generic, TypeVar

lowerCAmelCase__              =							TypeVar('''T''')






class 			__snake_case			(      Generic[T]):




  def __init__(					self	:		int		,   __lowerCAmelCase	:		T						):






         """simple docstring"""






         _lowerCamelCase		:							Optional[int]            =					data
         _lowerCamelCase		:							Node[T] | None            =					None




  def __str__(					self	:		Optional[Any]						):






         """simple docstring"""






         return f'''{self.data}'''






class 			__snake_case			(      Generic[T]):




  def __init__(					self	:		int						):






         """simple docstring"""






         _lowerCamelCase		:							Node[T] | None            =					None




  def __iter__(					self	:		str						):






         """simple docstring"""






         _lowerCamelCase		:							List[str]            =					self.top
         while node:
                yield node.data
                _lowerCamelCase		:							Any            =					node.next




  def __str__(					self	:		int						):






         """simple docstring"""






         return "->".join([str(__lowerCAmelCase						) for item in self]						)




  def __len__(					self	:		int						):






         """simple docstring"""






         return len(tuple(iter(self						)						)						)




  def 		SCREAMING_SNAKE_CASE							(					self	:		int						):






         """simple docstring"""






         return self.top is None




  def 		SCREAMING_SNAKE_CASE							(					self	:		int		,   __lowerCAmelCase	:		T						):






         """simple docstring"""






         _lowerCamelCase		:							Tuple            =					Node(__lowerCAmelCase						)
         if not self.is_empty():
                _lowerCamelCase		:							Optional[int]            =					self.top
         _lowerCamelCase		:							List[str]            =					node




  def 		SCREAMING_SNAKE_CASE							(					self	:		str						):






         """simple docstring"""






         if self.is_empty():
                raise IndexError('''pop from empty stack'''						)
         assert isinstance(self.top		,   __lowerCAmelCase						)
         _lowerCamelCase		:							Any            =					self.top
         _lowerCamelCase		:							Any            =					self.top.next
         return pop_node.data




  def 		SCREAMING_SNAKE_CASE							(					self	:		Optional[int]						):






         """simple docstring"""






         if self.is_empty():
                raise IndexError('''peek from empty stack'''						)

         assert self.top is not None
         return self.top.data




  def 		SCREAMING_SNAKE_CASE							(					self	:		Dict						):






         """simple docstring"""






         _lowerCamelCase		:							List[str]            =					None


if __name__ == "__main__":
   from doctest import testmod

   testmod()






'''simple docstring'''
def       a_				(	UpperCamelCase_ ):

							if length <= 0 or not isinstance(UpperCamelCase_						,  UpperCamelCase_ ):
														raise ValueError("Length must be a positive integer." )
							return [n * (2 * n - 1) for n in range(UpperCamelCase_ )]


if __name__ == "__main__":
							print(hexagonal_numbers(length=5))
							print(hexagonal_numbers(length=10))





