added permutations, but problem: takes too long (45 min)