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

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

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

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

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

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

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

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

d.q = l
a.u = n
a.s = h
a.w = h
b.z = l
l.u = b
l.w = b
l.s = h
n.z = l
e.q = c
h.z = l
c.u = b
c.s = n
c.w = h
assert e.q.u.z.u.z.s.z.txt == "l"