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

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

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

c = A("c")
m = B("m")
a = C("a")
i = C("i")
b = B("b")

c.t = b
c.z = i
c.r = i
m.w = a
a.v = b
i.v = m
b.w = a
assert a.v.w.v.w.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.z: C = None
        self.r: C = None
        self.txt = txt

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

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

c = A("c")
m = B("m")
a = C("a")
i = C("i")
b = B("b")

c.t = b
c.z = i
c.r = i
m.w = a
a.v = b
i.v = m
b.w = a
assert a.v.w.v.w.txt == "a"