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

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

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

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

d.t = m
m.u = d
l.y = m
assert m.u.t.u.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

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

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

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

d.t = m
m.u = d
l.y = m
assert m.u.t.u.txt == "d"