
"""simple docstring"""
from itertools import permutations

def 				lowercase      (_lowerCAmelCase = 5		):
						if gon_side < 3 or gon_side > 5:
												raise ValueError("""gon_side must be in the range [3, 5]"""		)

						# Since it's 16, we know 10 is on the outer ring
						# Put the big numbers at the end so that they are never the first number
						__lowerCAmelCase        =       list(range(gon_side + 1				,  0				,  -1		)		)
						__lowerCAmelCase        =       list(range(gon_side + 2				,  gon_side * 2 + 1		)		)

						for perm in permutations(small_numbers + big_numbers		):
												__lowerCAmelCase        =       generate_gon_ring(_lowerCAmelCase				,  list(_lowerCAmelCase		)		)
												if is_magic_gon(_lowerCAmelCase		):
																		return int("""""".join(str(_lowerCAmelCase		) for n in numbers		)		)

						__lowerCAmelCase        =       f"""Magic {gon_side}-gon ring is impossible"""
						raise ValueError(_lowerCAmelCase		)

def 				lowercase      (_lowerCAmelCase				,  _lowerCAmelCase		):
						__lowerCAmelCase        =       [0] * (gon_side * 3)
						__lowerCAmelCase        =       perm[0:3]
						perm.append(perm[1]		)

						__lowerCAmelCase        =       1 if gon_side < 5 else 2

						for i in range(1				,  len(_lowerCAmelCase		) // 3 + magic_number		):
												__lowerCAmelCase        =       perm[2 * i + 1]
												__lowerCAmelCase        =       result[3 * i - 1]
												__lowerCAmelCase        =       perm[2 * i + 2]

						return result

def 				lowercase      (_lowerCAmelCase		):
						if len(_lowerCAmelCase		) % 3 != 0:
												raise ValueError("""a gon ring should have a length that is a multiple of 3"""		)

						if min(numbers[::3]		) != numbers[0]:
												return False

						__lowerCAmelCase        =       sum(numbers[:3]		)

						return all(sum(numbers[i : i + 3]		) == total for i in range(3				,  len(_lowerCAmelCase		)				,  3		)		)


if __name__ == "__main__":
			print(solution())



"""simple docstring"""
from __future__ import annotations

from typing import Generic, TypeVar

SCREAMING_SNAKE_CASE_			      =					TypeVar('''T''')
class      lowerCAmelCase_						(							A__				):



							'''simple docstring'''





							pass
class      lowerCAmelCase_						(							A__				):



							'''simple docstring'''





							pass
class      lowerCAmelCase_						(							Generic[T]				):



							'''simple docstring'''





							def __init__(				self  ,							snake_case_ = 10							)   ->       Tuple:
													__lowerCAmelCase        =       []
													__lowerCAmelCase        =       limit




							def __bool__(				self							)   ->       bool:
													return bool(self.stack							)




							def __str__(				self							)   ->       str:
													return str(self.stack							)




							def  A__		(				self  ,							snake_case_							)   ->       None:
													if len(self.stack							) >= self.limit:
																			raise StackOverflowError
													self.stack.append(snake_case_							)




							def  A__		(				self							)   ->       T:
													if not self.stack:
																			raise StackUnderflowError
													return self.stack.pop()




							def  A__		(				self							)   ->       T:
													if not self.stack:
																			raise StackUnderflowError
													return self.stack[-1]




							def  A__		(				self							)   ->       bool:
													return not bool(self.stack							)




							def  A__		(				self							)   ->       bool:
													return self.size() == self.limit




							def  A__		(				self							)   ->       int:
													return len(self.stack							)




							def __contains__(				self  ,							snake_case_							)   ->       bool:
													return item in self.stack

def 				lowercase      ():
						__lowerCAmelCase        =       Stack(10		)
						assert bool(_lowerCAmelCase		) is False
						assert stack.is_empty() is True
						assert stack.is_full() is False
						assert str(_lowerCAmelCase		) == "[]"

						try:
												__lowerCAmelCase        =       stack.pop()
												raise AssertionError  # This should not happen
						except StackUnderflowError:
												assert True  # This should happen

						try:
												__lowerCAmelCase        =       stack.peek()
												raise AssertionError  # This should not happen
						except StackUnderflowError:
												assert True  # This should happen

						for i in range(10		):
												assert stack.size() == i
												stack.push(_lowerCAmelCase		)

						assert bool(_lowerCAmelCase		)
						assert not stack.is_empty()
						assert stack.is_full()
						assert str(_lowerCAmelCase		) == str(list(range(10		)		)		)
						assert stack.pop() == 9
						assert stack.peek() == 8

						stack.push(100		)
						assert str(_lowerCAmelCase		) == str([0, 1, 2, 3, 4, 5, 6, 7, 8, 100]		)

						try:
												stack.push(200		)
												raise AssertionError  # This should not happen
						except StackOverflowError:
												assert True  # This should happen

						assert not stack.is_empty()
						assert stack.size() == 10

						assert 5 in stack
						assert 55 not in stack


if __name__ == "__main__":
			test_stack()
