implement next permutation in simple way