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

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

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

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

e.t = i
e.u = m
i.w = m
m.p = e
m.z = e
assert e.t.w.z.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.u: C = None
        self.txt = txt

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

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

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

e.t = i
e.u = m
i.w = m
m.p = e
m.z = e
assert e.t.w.z.txt == "e"