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

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

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

m = A("m")
b = B("b")
d = C("d")
n = C("n")
a = A("a")
l = A("l")
e = A("e")
i = A("i")
k = C("k")
j = B("j")

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

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

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

m = A("m")
b = B("b")
d = C("d")
n = C("n")
a = A("a")
l = A("l")
e = A("e")
i = A("i")
k = C("k")
j = B("j")

m.z = i
m.o = n
b.p = m
d.o = j
d.w = j
d.s = k
n.o = j
n.w = j
n.s = d
a.z = e
a.o = k
l.z = a
l.o = d
e.z = a
e.o = d
i.z = l
i.o = n
k.o = j
k.w = b
k.s = d
j.p = l
assert b.p.z.z.z.z.z.z.o.s.txt == "k"