





"""simple docstring"""





from itertools import permutations




def 		lowerCAmelCase_     (  lowercase_       :							int = 5		):

 '''simple docstring'''






 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
 __SCREAMING_SNAKE_CASE			:      int 							=	list(range(gon_side + 1			,				0			,				-1		)		)
 __SCREAMING_SNAKE_CASE			:      List[Any] 							=	list(range(gon_side + 2			,				gon_side * 2 + 1		)		)

 for perm in permutations(small_numbers + big_numbers		):
  __SCREAMING_SNAKE_CASE			:      Any 							=	generate_gon_ring(lowercase_			,				list(lowercase_		)		)
  if is_magic_gon(lowercase_		):
   return int(''''''.join(str(lowercase_		) for n in numbers		)		)

 __SCREAMING_SNAKE_CASE			:      Optional[Any] 							=	F'''Magic {gon_side}-gon ring is impossible'''
 raise ValueError(lowercase_		)




def 		lowerCAmelCase_     (  lowercase_       :							int			,				lowercase_       :							list[int]		):

 '''simple docstring'''






 __SCREAMING_SNAKE_CASE			:      Optional[Any] 							=	[0] * (gon_side * 3)
 __SCREAMING_SNAKE_CASE			:      List[str] 							=	perm[0:3]
 perm.append(perm[1]		)

 __SCREAMING_SNAKE_CASE			:      Optional[Any] 							=	1 if gon_side < 5 else 2

 for i in range(1			,				len(lowercase_		) // 3 + magic_number		):
  __SCREAMING_SNAKE_CASE			:      int 							=	perm[2 * i + 1]
  __SCREAMING_SNAKE_CASE			:      List[Any] 							=	result[3 * i - 1]
  __SCREAMING_SNAKE_CASE			:      List[Any] 							=	perm[2 * i + 2]

 return result




def 		lowerCAmelCase_     (  lowercase_       :							list[int]		):

 '''simple docstring'''






 if len(lowercase_		) % 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

 __SCREAMING_SNAKE_CASE			:      str 							=	sum(numbers[:3]		)

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


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








"""simple docstring"""





from ..utils import DummyObject, requires_backends





class       snake_case		(       metaclass=__UpperCAmelCase       ):
      lowerCamelCase__      =			['''torch''', '''transformers''', '''invisible_watermark''']

      def __init__(      self       :Optional[int]						,							*_lowerCamelCase       :int						,							**_lowerCamelCase       :Any						):
       requires_backends(self						,							['''torch''', '''transformers''', '''invisible_watermark''']						)

      @classmethod
      def 						SCREAMING_SNAKE_CASE_      (      cls       :Dict						,							*_lowerCamelCase       :Optional[Any]						,							**_lowerCamelCase       :int						):
       requires_backends(cls						,							['''torch''', '''transformers''', '''invisible_watermark''']						)



      @classmethod
      def 						SCREAMING_SNAKE_CASE_      (      cls       :Optional[int]						,							*_lowerCamelCase       :Optional[Any]						,							**_lowerCamelCase       :Union[str, Any]						):
       requires_backends(cls						,							['''torch''', '''transformers''', '''invisible_watermark''']						)







class       snake_case		(       metaclass=__UpperCAmelCase       ):
      lowerCamelCase__      =			['''torch''', '''transformers''', '''invisible_watermark''']

      def __init__(      self       :Dict						,							*_lowerCamelCase       :Dict						,							**_lowerCamelCase       :Optional[Any]						):
       requires_backends(self						,							['''torch''', '''transformers''', '''invisible_watermark''']						)

      @classmethod
      def 						SCREAMING_SNAKE_CASE_      (      cls       :Optional[int]						,							*_lowerCamelCase       :int						,							**_lowerCamelCase       :Optional[int]						):
       requires_backends(cls						,							['''torch''', '''transformers''', '''invisible_watermark''']						)



      @classmethod
      def 						SCREAMING_SNAKE_CASE_      (      cls       :List[Any]						,							*_lowerCamelCase       :Dict						,							**_lowerCamelCase       :List[str]						):
       requires_backends(cls						,							['''torch''', '''transformers''', '''invisible_watermark''']						)

