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

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

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

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

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

m = A("m")
g = B("g")
e = C("e")
l = D("l")
a = E("a")

m.s = e
m.v = g
m.w = l
g.o = a
e.p = l
l.u = e
a.s = e
assert l.u.p.u.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.v: B = None
        self.w: D = None
        self.txt = txt

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

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

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

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

m = A("m")
g = B("g")
e = C("e")
l = D("l")
a = E("a")

m.s = e
m.v = g
m.w = l
g.o = a
e.p = l
l.u = e
a.s = e
assert l.u.p.u.txt == "e"