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

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

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

class D:
    def __init__(self, txt: str):
        self.p: B = None
        self.s: C = None
        self.o: C = None
        self.w: C = None
        self.txt = txt

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

n = A("n")
m = B("m")
g = C("g")
a = D("a")
j = E("j")
e = C("e")
i = E("i")

n.x = m
n.p = g
m.u = j
m.o = e
g.w = e
a.p = m
a.s = e
a.w = e
a.o = g
j.s = m
j.q = g
j.w = g
j.x = i
j.z = i
e.w = g
i.s = m
i.q = e
i.x = j
i.z = j
i.w = g
assert a.o.w.w.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.p: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.p: B = None
        self.s: C = None
        self.o: C = None
        self.w: C = None
        self.txt = txt

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

n = A("n")
m = B("m")
g = C("g")
a = D("a")
j = E("j")
e = C("e")
i = E("i")

n.x = m
n.p = g
m.u = j
m.o = e
g.w = e
a.p = m
a.s = e
a.w = e
a.o = g
j.s = m
j.q = g
j.w = g
j.x = i
j.z = i
e.w = g
i.s = m
i.q = e
i.x = j
i.z = j
i.w = g
assert a.o.w.w.w.w.txt == "g"