Instead of using List<Matrix> for generating all permutations Generator class is used