class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.t: 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.y: A = None
        self.txt = txt

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

m.o = e
m.t = e
i.x = e
e.y = m
assert i.x.y.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.t: 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.y: A = None
        self.txt = txt

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

m.o = e
m.t = e
i.x = e
e.y = m
assert i.x.y.o.txt == "e"