class A:
    def __init__(self, txt: str):
        self.w: B = 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.x: C = None
        self.u: D = None
        self.z: D = None
        self.txt = txt

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

e = A("e")
b = B("b")
d = C("d")
n = D("n")
m = D("m")
k = D("k")
g = C("g")
f = C("f")
h = C("h")

e.w = b
b.u = h
d.x = h
d.u = m
d.z = m
n.w = k
m.w = k
k.w = n
g.x = h
g.u = k
g.z = k
f.x = d
f.u = m
f.z = k
h.x = g
h.u = n
h.z = m
assert e.w.u.u.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = 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.x: C = None
        self.u: D = None
        self.z: D = None
        self.txt = txt

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

e = A("e")
b = B("b")
d = C("d")
n = D("n")
m = D("m")
k = D("k")
g = C("g")
f = C("f")
h = C("h")

e.w = b
b.u = h
d.x = h
d.u = m
d.z = m
n.w = k
m.w = k
k.w = n
g.x = h
g.u = k
g.z = k
f.x = d
f.u = m
f.z = k
h.x = g
h.u = n
h.z = m
assert e.w.u.u.w.w.txt == "n"