check permutation