simple version of 9.5 using itertools