Itertools Permutations Hackerrank Solution