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

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

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

a = A("a")
h = B("h")
m = C("m")
n = C("n")
e = A("e")
g = B("g")
d = C("d")
c = B("c")
i = B("i")

a.y = i
a.o = d
a.u = c
h.s = e
h.z = c
m.o = h
n.o = h
e.y = g
e.u = g
e.o = d
g.s = a
g.z = c
d.o = h
c.s = e
c.z = g
i.s = e
i.z = c
assert e.o.o.z.s.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.o: C = None
        self.u: B = None
        self.txt = txt

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

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

a = A("a")
h = B("h")
m = C("m")
n = C("n")
e = A("e")
g = B("g")
d = C("d")
c = B("c")
i = B("i")

a.y = i
a.o = d
a.u = c
h.s = e
h.z = c
m.o = h
n.o = h
e.y = g
e.u = g
e.o = d
g.s = a
g.z = c
d.o = h
c.s = e
c.z = g
i.s = e
i.z = c
assert e.o.o.z.s.txt == "e"