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

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

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

e = A("e")
i = B("i")
c = C("c")

e.o = i
e.s = c
i.z = e
c.r = e
assert e.o.z.s.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.s: C = None
        self.txt = txt

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

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

e = A("e")
i = B("i")
c = C("c")

e.o = i
e.s = c
i.z = e
c.r = e
assert e.o.z.s.txt == "c"