from random import randrange
def fy_iter(n):
swaps = {}
def getswapval(k):
if k in swaps: return swaps[k]
return k
for i in range(n):
k = randrange(i,n)
yield getswapval(k)
swaps[k] = getswapval(i)
if i in swaps: del swaps[i]
for x in fy_iter (10): print(x)
ZnJvbSByYW5kb20gaW1wb3J0IHJhbmRyYW5nZQoKZGVmIGZ5X2l0ZXIobik6CiBzd2FwcyA9IHt9CiBkZWYgZ2V0c3dhcHZhbChrKToKICBpZiBrIGluIHN3YXBzOiByZXR1cm4gc3dhcHNba10KICByZXR1cm4gawogZm9yIGkgaW4gcmFuZ2Uobik6CiAgayA9IHJhbmRyYW5nZShpLG4pCiAgeWllbGQgZ2V0c3dhcHZhbChrKQogIHN3YXBzW2tdID0gZ2V0c3dhcHZhbChpKQogIGlmIGkgaW4gc3dhcHM6IGRlbCBzd2Fwc1tpXQoKZm9yIHggaW4gZnlfaXRlciAoMTApOiBwcmludCh4KQogIA==