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

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

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

e = A("e")
f = B("f")
h = C("h")

e.t = f
e.p = h
f.y = e
f.o = h
f.s = h
h.z = e
h.r = e
assert h.z.t.y.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.p: C = None
        self.txt = txt

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

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

e = A("e")
f = B("f")
h = C("h")

e.t = f
e.p = h
f.y = e
f.o = h
f.s = h
h.z = e
h.r = e
assert h.z.t.y.txt == "e"