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

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

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

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

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

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

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

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

l.t = d
l.y = m
l.o = m
m.t = l
d.w = m
assert l.y.t.y.txt == "m"