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

class B:
    def __init__(self, txt: str):
        self.s: D = None
        self.y: E = None
        self.t: E = None
        self.o: C = None
        self.p: D = None
        self.txt = txt

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

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

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

c = A("c")
d = B("d")
l = C("l")
h = D("h")
m = E("m")
e = E("e")
a = C("a")
n = E("n")
i = B("i")

c.o = h
c.x = h
d.s = h
d.p = h
d.y = m
d.t = e
d.o = l
l.t = a
l.o = n
h.r = d
m.z = l
e.z = l
a.t = l
a.o = m
n.z = l
i.s = h
i.p = h
i.y = m
i.t = e
i.o = a
assert d.y.z.o.z.o.z.o.z.t.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.x: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: D = None
        self.y: E = None
        self.t: E = None
        self.o: C = None
        self.p: D = None
        self.txt = txt

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

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

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

c = A("c")
d = B("d")
l = C("l")
h = D("h")
m = E("m")
e = E("e")
a = C("a")
n = E("n")
i = B("i")

c.o = h
c.x = h
d.s = h
d.p = h
d.y = m
d.t = e
d.o = l
l.t = a
l.o = n
h.r = d
m.z = l
e.z = l
a.t = l
a.o = m
n.z = l
i.s = h
i.p = h
i.y = m
i.t = e
i.o = a
assert d.y.z.o.z.o.z.o.z.t.txt == "a"