Generator fun
Using itertools was a bad idea for this problem, the while loop exhausted the generator, leading to a bug