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

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

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

e = A("e")
c = B("c")
n = C("n")
j = B("j")
l = A("l")
h = C("h")
d = B("d")
m = B("m")
a = B("a")

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

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

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

e = A("e")
c = B("c")
n = C("n")
j = B("j")
l = A("l")
h = C("h")
d = B("d")
m = B("m")
a = B("a")

e.w = l
e.q = n
c.u = n
n.z = e
n.w = j
j.u = n
l.w = e
l.q = n
h.z = l
h.w = a
d.u = n
m.u = h
a.u = n
assert l.q.w.u.w.u.z.txt == "e"