generate and print permutations