next permutation solved