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

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

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

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

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

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

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

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

h.x = e
h.o = e
h.s = m
m.p = e
m.r = e
m.t = h
e.x = m
e.v = m
assert e.v.p.x.txt == "m"