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

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

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

a = A("a")
m = B("m")
e = C("e")
k = A("k")
b = A("b")
d = B("d")
l = C("l")
i = A("i")
g = B("g")
c = C("c")

a.s = d
a.w = b
m.z = d
m.y = d
m.q = e
e.q = g
e.t = i
k.s = g
k.w = i
b.s = g
b.w = k
d.z = m
d.y = m
d.q = e
l.q = m
l.t = k
i.s = g
i.w = b
g.z = d
g.y = d
g.q = l
c.q = d
c.t = i
assert a.w.s.q.t.s.q.t.s.q.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.w: A = None
        self.txt = txt

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

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

a = A("a")
m = B("m")
e = C("e")
k = A("k")
b = A("b")
d = B("d")
l = C("l")
i = A("i")
g = B("g")
c = C("c")

a.s = d
a.w = b
m.z = d
m.y = d
m.q = e
e.q = g
e.t = i
k.s = g
k.w = i
b.s = g
b.w = k
d.z = m
d.y = m
d.q = e
l.q = m
l.t = k
i.s = g
i.w = b
g.z = d
g.y = d
g.q = l
c.q = d
c.t = i
assert a.w.s.q.t.s.q.t.s.q.txt == "l"