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

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

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

l = A("l")
m = B("m")
d = C("d")

l.s = d
l.z = d
m.y = l
m.w = l
d.t = l
assert l.s.t.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.z: C = None
        self.txt = txt

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

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

l = A("l")
m = B("m")
d = C("d")

l.s = d
l.z = d
m.y = l
m.w = l
d.t = l
assert l.s.t.s.txt == "d"