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

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

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

d = A("d")
m = B("m")
j = C("j")
i = B("i")

d.z = j
d.y = m
m.w = i
j.t = m
j.v = d
i.w = m
assert i.w.w.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.y: B = None
        self.txt = txt

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

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

d = A("d")
m = B("m")
j = C("j")
i = B("i")

d.z = j
d.y = m
m.w = i
j.t = m
j.v = d
i.w = m
assert i.w.w.w.w.txt == "i"