# 1216.py def orbita (x,f): A=set([x]) while 1: x=f(x) if x in A: return A A.add(x)