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

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

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

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

h.o = i
h.z = e
h.y = g
m.t = g
i.x = h
i.o = h
i.s = e
e.x = h
e.o = h
e.s = i
g.t = m
assert h.z.o.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.z: C = None
        self.y: B = None
        self.txt = txt

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

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

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

h.o = i
h.z = e
h.y = g
m.t = g
i.x = h
i.o = h
i.s = e
e.x = h
e.o = h
e.s = i
g.t = m
assert h.z.o.o.o.txt == "h"