naive version of permutation