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

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

c = A("c")
g = B("g")
f = A("f")
m = A("m")
d = B("d")
l = B("l")
k = A("k")
j = A("j")
h = A("h")
e = A("e")

c.z = d
c.v = g
g.z = l
f.z = l
f.v = g
m.z = d
m.v = l
d.z = l
l.z = g
k.z = l
k.v = d
j.z = g
j.v = l
h.z = l
h.v = g
e.z = g
e.v = d
assert e.z.z.z.z.z.z.z.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.v: B = None
        self.txt = txt

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

c = A("c")
g = B("g")
f = A("f")
m = A("m")
d = B("d")
l = B("l")
k = A("k")
j = A("j")
h = A("h")
e = A("e")

c.z = d
c.v = g
g.z = l
f.z = l
f.v = g
m.z = d
m.v = l
d.z = l
l.z = g
k.z = l
k.v = d
j.z = g
j.v = l
h.z = l
h.v = g
e.z = g
e.v = d
assert e.z.z.z.z.z.z.z.z.z.txt == "g"