input: Write a python function to determine the permutation perm of an array nums which holds values from [0, 1, 2, ..., n-1]. The goal is to find the permutation that minimizes the given score function:
  
  score(perm) = |perm[0] - nums[perm[1]]| + |perm[1] - nums[perm[2]]| + ... + |perm[n - 1] - nums[perm[0]]|
  
  If there are multiple permutations with the same minimum score, return the lexicographically smallest one.
  
  from typing import List
  
  def optimal_permutation(nums: List[int]) -> List[int]:
      """
      You are given an array nums representing a permutation of [0, 1, 2, ..., n - 1]. The goal is to find a permutation perm such that:
  
      score(perm) = |perm[0] - nums[perm[1]]| + |perm[1] - nums[perm[2]]| + ... + |perm[n - 1] - nums[perm[0]]|
  
      The function should return the permutation that results in the smallest possible score. When there are multiple permutations with the same score, it returns the lexicographically smallest permutation.
  
      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: def optimal_permutation(nums: List[int]) -> List[int]:
      n = len(nums)
      return list(range(n))