
    Given a delivery route number where each digit represents a checkpoint sequence, determine the next viable route number that visits all the same checkpoints but in a slightly different order, ensuring it's the smallest possible number greater than the original route. The new route must use exactly the same checkpoints (digits) as the original route, just rearranged, and if no such rearrangement is possible that creates a larger number, return -1.
    

    
def rearrange_bigger(n):
    """
    Given a delivery route number where each digit represents a checkpoint sequence, determine the next viable route number that visits all the same checkpoints but in a slightly different order, ensuring it's the smallest possible number greater than the original route. The new route must use exactly the same checkpoints (digits) as the original route, just rearranged, and if no such rearrangement is possible that creates a larger number, return -1.
    

    """
def rearrange_bigger(n):
    """
    Given a delivery route number where each digit represents a checkpoint sequence, determine the next viable route number that visits all the same checkpoints but in a slightly different order, ensuring it's the smallest possible number greater than the original route. The new route must use exactly the same checkpoints (digits) as the original route, just rearranged, and if no such rearrangement is possible that creates a larger number, return -1.
    

    """
    nums = list(str(n))
    for i in range(len(nums) - 2, -1, -1):
        if nums[i] < nums[i + 1]:
            z = nums[i:]
            y = min(filter(lambda x: x > z[0], z))
            z.remove(y)
            z.sort()
            nums[i:] = [y] + z
            return int(''.join(nums))
    return False