class A:
    def __init__(self, txt: str):
        self.o: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: A = None
        self.txt = txt

e = A("e")
c = B("c")
d = B("d")
h = A("h")
j = B("j")
k = B("k")
n = A("n")
l = A("l")
g = A("g")
b = A("b")

e.o = l
c.z = g
d.z = b
h.o = e
j.z = l
k.z = l
n.o = l
l.o = e
g.o = b
b.o = e
assert j.z.o.o.o.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: A = None
        self.txt = txt

e = A("e")
c = B("c")
d = B("d")
h = A("h")
j = B("j")
k = B("k")
n = A("n")
l = A("l")
g = A("g")
b = A("b")

e.o = l
c.z = g
d.z = b
h.o = e
j.z = l
k.z = l
n.o = l
l.o = e
g.o = b
b.o = e
assert j.z.o.o.o.o.o.txt == "e"