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

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

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

m = A("m")
l = B("l")
n = C("n")
i = B("i")
d = C("d")
f = B("f")
c = B("c")
b = B("b")
k = A("k")
a = B("a")

m.w = i
m.s = n
l.u = k
l.p = m
n.x = d
n.q = d
n.z = m
i.u = k
i.p = k
d.x = n
d.q = n
d.z = k
f.u = m
f.p = k
c.u = k
c.p = k
b.u = m
b.p = m
k.w = b
k.s = d
a.u = m
a.p = k
assert l.u.s.z.w.u.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.s: C = None
        self.txt = txt

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

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

m = A("m")
l = B("l")
n = C("n")
i = B("i")
d = C("d")
f = B("f")
c = B("c")
b = B("b")
k = A("k")
a = B("a")

m.w = i
m.s = n
l.u = k
l.p = m
n.x = d
n.q = d
n.z = m
i.u = k
i.p = k
d.x = n
d.q = n
d.z = k
f.u = m
f.p = k
c.u = k
c.p = k
b.u = m
b.p = m
k.w = b
k.s = d
a.u = m
a.p = k
assert l.u.s.z.w.u.txt == "m"