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

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

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

m = A("m")
n = B("n")
k = C("k")
f = B("f")
a = B("a")
g = C("g")
b = A("b")
e = C("e")
l = C("l")
c = A("c")

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

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

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

m = A("m")
n = B("n")
k = C("k")
f = B("f")
a = B("a")
g = C("g")
b = A("b")
e = C("e")
l = C("l")
c = A("c")

m.s = l
m.q = a
n.w = l
k.s = g
k.u = b
f.w = k
a.w = g
g.s = k
g.u = m
b.s = k
b.q = f
e.s = k
e.u = b
l.s = k
l.u = c
c.s = e
c.q = f
assert e.u.q.w.txt == "k"