




from itertools import permutations

def       UpperCAmelCase_							(   __UpperCAmelCase		:			str = 5							)      ->				int:





      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_					=    list(range(gon_side + 1    ,    0    ,    -1							)							)
      SCREAMING_SNAKE_CASE_					=    list(range(gon_side + 2    ,    gon_side * 2 + 1							)							)

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

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

def       UpperCAmelCase_							(   __UpperCAmelCase		:			int    ,    __UpperCAmelCase		:			str							)      ->				list[int]:
      SCREAMING_SNAKE_CASE_					=    [0] * (gon_side * 3)
      SCREAMING_SNAKE_CASE_					=    perm[0:3]
      perm.append(perm[1]							)

      SCREAMING_SNAKE_CASE_					=    1 if gon_side < 5 else 2

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

      return result

def       UpperCAmelCase_							(   __UpperCAmelCase		:			Optional[int]							)      ->				bool:





      if len(__a							) % 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_					=    sum(numbers[:3]							)

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


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





from collections import defaultdict

def       UpperCAmelCase_							(   __UpperCAmelCase		:			int = 5							)      ->				int:
      SCREAMING_SNAKE_CASE_					=    defaultdict(__UpperCAmelCase							)
      SCREAMING_SNAKE_CASE_					=    0

      while True:
            SCREAMING_SNAKE_CASE_					=    get_digits(__UpperCAmelCase							)
            freqs[digits].append(__UpperCAmelCase							)

            if len(freqs[digits]							) == max_base:
                  SCREAMING_SNAKE_CASE_					=    freqs[digits][0] ** 3
                  return base

            num += 1

def       UpperCAmelCase_							(   __UpperCAmelCase		:			int							)      ->				str:
      return "".join(sorted(str(num**3							)							)							)


if __name__ == "__main__":
   print(f'''{solution() = }''')