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

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

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

k = A("k")
n = B("n")
h = C("h")
m = B("m")
j = A("j")
c = C("c")
i = A("i")
b = C("b")
a = C("a")
e = C("e")

k.w = n
k.s = a
k.z = e
n.q = m
h.w = b
h.p = k
h.o = n
m.q = n
j.w = n
j.s = e
j.z = h
c.w = h
c.p = k
c.o = n
i.w = n
i.s = c
i.z = a
b.w = c
b.p = i
b.o = m
a.w = e
a.p = k
a.o = n
e.w = c
e.p = i
e.o = n
assert b.p.z.o.q.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.s: C = None
        self.z: C = None
        self.txt = txt

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

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

k = A("k")
n = B("n")
h = C("h")
m = B("m")
j = A("j")
c = C("c")
i = A("i")
b = C("b")
a = C("a")
e = C("e")

k.w = n
k.s = a
k.z = e
n.q = m
h.w = b
h.p = k
h.o = n
m.q = n
j.w = n
j.s = e
j.z = h
c.w = h
c.p = k
c.o = n
i.w = n
i.s = c
i.z = a
b.w = c
b.p = i
b.o = m
a.w = e
a.p = k
a.o = n
e.w = c
e.p = i
e.o = n
assert b.p.z.o.q.txt == "m"