def gen():
for i in range(10):
res = yield i
if res:
yield res
pushed = False
g = gen()
for x in g:
print(x)
if (x == 5) and (pushed == False):
g.send(x)
pushed = True
ZGVmIGdlbigpOgogICAgZm9yIGkgaW4gcmFuZ2UoMTApOgogICAgICAgIHJlcyA9IHlpZWxkIGkKICAgICAgICBpZiByZXM6CiAgICAgICAgICAgIHlpZWxkIHJlcwoKcHVzaGVkID0gRmFsc2UKZyA9IGdlbigpCmZvciB4IGluIGc6CiAgICBwcmludCh4KQogICAgaWYgKHggPT0gNSkgYW5kIChwdXNoZWQgPT0gRmFsc2UpOgogICAgICAgIGcuc2VuZCh4KQogICAgICAgIHB1c2hlZCA9IFRydWU=