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

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

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

l = A("l")
i = B("i")
j = C("j")

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

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

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

l = A("l")
i = B("i")
j = C("j")

l.o = j
i.r = j
j.t = l
assert i.r.t.o.txt == "j"