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

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

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

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

c.r = l
m.x = l
l.o = m
l.t = m
l.x = m
assert l.x.x.t.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.txt = txt

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

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

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

c.r = l
m.x = l
l.o = m
l.t = m
l.x = m
assert l.x.x.t.txt == "m"