import os
import itertools

r=os.popen('more','w')
for c in itertools.cycle('A\nB\nC\nD\nE\nF\n'):
    r.write(c) 
r.close()
