
from itertools import permutations





def 		SCREAMING_SNAKE_CASE__      ( __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
    snake_case__  =			list(range(gon_side + 1      ,						0      ,						-1							)							)
    snake_case__  =			list(range(gon_side + 2      ,						gon_side * 2 + 1							)							)

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

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





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

    snake_case__  =			1 if gon_side < 5 else 2

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

    return result





def 		SCREAMING_SNAKE_CASE__      ( __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

    snake_case__  =			sum(numbers[:3]							)

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


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





# Copyright 2023 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from typing import TYPE_CHECKING

# rely on isort to merge the imports
from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_torch_available,
)


__magic_name__           =					{
    '''configuration_convnextv2''': [
        '''CONVNEXTV2_PRETRAINED_CONFIG_ARCHIVE_MAP''',
        '''ConvNextV2Config''',
    ]
}

try:
     if not is_torch_available():
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     pass
else:
     __magic_name__           =					[
         '''CONVNEXTV2_PRETRAINED_MODEL_ARCHIVE_LIST''',
         '''ConvNextV2ForImageClassification''',
         '''ConvNextV2Model''',
         '''ConvNextV2PreTrainedModel''',
         '''ConvNextV2Backbone''',
     ]


if TYPE_CHECKING:
     from .configuration_convnextva import (
         CONVNEXTV2_PRETRAINED_CONFIG_ARCHIVE_MAP,
         ConvNextVaConfig,
     )

     try:
          if not is_torch_available():
               raise OptionalDependencyNotAvailable()
     except OptionalDependencyNotAvailable:
          pass
     else:
          from .modeling_convnextva import (
              CONVNEXTV2_PRETRAINED_MODEL_ARCHIVE_LIST,
              ConvNextVaBackbone,
              ConvNextVaForImageClassification,
              ConvNextVaModel,
              ConvNextVaPreTrainedModel,
          )

else:
     import sys

     __magic_name__           =					_LazyModule(__name__, globals()['''__file__'''], _import_structure)



