implemented permutaitons function