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

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

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

e = A("e")
d = B("d")
k = C("k")
a = C("a")
c = B("c")
i = A("i")
f = B("f")
h = B("h")
j = C("j")
m = B("m")

e.u = a
e.t = k
d.u = a
d.w = h
d.s = e
k.s = e
k.z = c
k.q = d
a.s = e
a.z = h
a.q = d
c.u = a
c.w = h
c.s = i
i.u = j
i.t = a
f.u = k
f.w = d
f.s = i
h.u = a
h.w = m
h.s = e
j.s = e
j.z = c
j.q = m
m.u = a
m.w = d
m.s = i
assert a.q.w.u.q.w.w.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.t: C = None
        self.txt = txt

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

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

e = A("e")
d = B("d")
k = C("k")
a = C("a")
c = B("c")
i = A("i")
f = B("f")
h = B("h")
j = C("j")
m = B("m")

e.u = a
e.t = k
d.u = a
d.w = h
d.s = e
k.s = e
k.z = c
k.q = d
a.s = e
a.z = h
a.q = d
c.u = a
c.w = h
c.s = i
i.u = j
i.t = a
f.u = k
f.w = d
f.s = i
h.u = a
h.w = m
h.s = e
j.s = e
j.z = c
j.q = m
m.u = a
m.w = d
m.s = i
assert a.q.w.u.q.w.w.u.txt == "a"