Anagram factorization