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

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

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

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

e.p = n
e.t = m
n.x = m
n.z = m
m.o = e
m.t = e
assert e.p.x.t.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.t: C = None
        self.txt = txt

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

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

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

e.p = n
e.t = m
n.x = m
n.z = m
m.o = e
m.t = e
assert e.p.x.t.txt == "e"