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

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

class C:
    def __init__(self, txt: str):
        self.r: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.u: D = None
        self.txt = txt

j = A("j")
e = B("e")
l = C("l")
m = D("m")
k = E("k")
n = B("n")
g = E("g")

j.w = k
e.u = n
e.o = n
l.r = m
m.q = l
m.w = n
m.z = j
k.u = m
n.u = e
n.o = e
g.u = m
assert m.w.o.o.u.txt == "
class A:
    def __init__(self, txt: str):
        self.w: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.r: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.u: D = None
        self.txt = txt

j = A("j")
e = B("e")
l = C("l")
m = D("m")
k = E("k")
n = B("n")
g = E("g")

j.w = k
e.u = n
e.o = n
l.r = m
m.q = l
m.w = n
m.z = j
k.u = m
n.u = e
n.o = e
g.u = m
assert m.w.o.o.u.txt == "e"