input: from typing import List
  
  def get_min_score_permutation(nums: List[int]) -> List[int]:
      """
      Given an array nums which is a permutation of [0, 1, 2, ..., n - 1], the score of any permutation of [0, 1, 2, ..., n - 1] termed as perm is calculated by:
  
      score(perm) = |perm[0] - nums[perm[1]]| + |perm[1] - nums[perm[2]]| + ... + |perm[n - 1] - nums[perm[0]]|
  
      Find and return the permutation perm that achieves the lowest possible score. If there are multiple permutations with the same score, return the one that is smallest in lexicographical order.
  
      Examples:
      >>> nums = [1,0,2]
      [0,1,2]
      >>> nums = [0,2,1]
      [0,2,1]
  
      Constraints:
      2 <= n == nums.length <= 14
      nums is a permutation of [0, 1, 2, ..., n - 1].
      """
output:     from itertools import permutations
      
      def calculate_score(perm, nums):
          n = len(perm)
          score = 0
          for i in range(n):
              score += abs(perm[i] - nums[perm[(i + 1) % n]])
          return score
  
      min_perm = None
      min_score = float('inf')
  
      for perm in permutations(range(len(nums))):
          score = calculate_score(perm, nums)
          if score < min_score or (score == min_score and perm < min_perm):
              min_score = score
              min_perm = perm
  
      return list(min_perm)