permutation check