import itertools

def riseEqFall(num):
    
    height = 0
    d1 = num% 10
    num 
    while num:
        d2 = num% 10
        height += (d1<d2) - (d1>d2)
        d1 = d2
        num 
    return height == 0

def sequence(start, fn):
    
    num=start-1
    while True:
        num += 1
        while not fn(num): num += 1
        yield num

a296712 = sequence(1, riseEqFall)


print()
print(*itertools.islice(a296712, 200))


print()
print(*itertools.islice(a296712, 10000000-200-1, 10000000-200))