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

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

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

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

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

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

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

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

e.s = c
d.q = i
d.p = l
i.z = n
i.y = e
i.u = l
m.z = a
m.y = l
m.u = l
c.q = m
c.p = l
l.s = d
n.q = h
n.p = e
a.q = h
a.p = l
h.z = d
h.y = l
h.u = l
assert c.p.s.q.txt == "i"