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

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

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

e = A("e")
h = B("h")
d = C("d")

e.z = d
h.u = d
d.w = h
d.y = h
assert h.u.y.u.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.txt = txt

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

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

e = A("e")
h = B("h")
d = C("d")

e.z = d
h.u = d
d.w = h
d.y = h
assert h.u.y.u.txt == "d"