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

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

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

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

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

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

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

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

m.t = c
n.z = m
n.o = m
n.t = d
c.s = h
c.x = m
j.z = m
j.o = m
j.t = e
d.z = m
d.o = m
d.t = e
h.z = m
h.o = m
h.t = d
g.z = m
g.o = m
g.t = d
e.z = m
e.o = m
e.t = h
a.s = j
a.x = m
assert e.o.t.s.o.t.s.z.t.s.txt == "h"