Update P24.py to use itertools.permutation