class A:
    def __init__(self, txt: str):
        self.w: 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: C = None
        self.txt = txt

j = A("j")
d = B("d")
c = C("c")
k = B("k")
n = B("n")
b = C("b")
m = A("m")
e = A("e")

j.w = c
d.v = j
c.z = b
k.v = e
n.v = e
b.z = c
m.w = c
e.w = c
assert c.z.z.z.z.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.w: 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: C = None
        self.txt = txt

j = A("j")
d = B("d")
c = C("c")
k = B("k")
n = B("n")
b = C("b")
m = A("m")
e = A("e")

j.w = c
d.v = j
c.z = b
k.v = e
n.v = e
b.z = c
m.w = c
e.w = c
assert c.z.z.z.z.z.z.txt == "c"