pattern permutations working