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

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

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

m = A("m")
a = B("a")
d = C("d")
b = A("b")
f = C("f")
c = A("c")
e = B("e")
h = C("h")
k = C("k")

m.w = k
m.z = d
a.v = b
d.z = c
b.w = f
b.z = f
f.z = c
c.w = f
c.z = h
e.v = c
h.z = m
k.z = b
assert c.z.z.w.z.z.z.z.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.z: C = None
        self.txt = txt

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

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

m = A("m")
a = B("a")
d = C("d")
b = A("b")
f = C("f")
c = A("c")
e = B("e")
h = C("h")
k = C("k")

m.w = k
m.z = d
a.v = b
d.z = c
b.w = f
b.z = f
f.z = c
c.w = f
c.z = h
e.v = c
h.z = m
k.z = b
assert c.z.z.w.z.z.z.z.z.z.txt == "d"