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

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

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

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

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

m = A("m")
n = B("n")
e = C("e")
c = D("c")
d = E("d")
l = A("l")
b = D("b")

m.s = e
m.t = c
m.v = d
n.w = m
e.w = n
c.w = b
c.q = n
d.p = e
l.s = e
l.t = c
l.v = d
b.w = c
b.q = n
assert d.p.w.w.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.t: D = None
        self.v: E = None
        self.txt = txt

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

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

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

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

m = A("m")
n = B("n")
e = C("e")
c = D("c")
d = E("d")
l = A("l")
b = D("b")

m.s = e
m.t = c
m.v = d
n.w = m
e.w = n
c.w = b
c.q = n
d.p = e
l.s = e
l.t = c
l.v = d
b.w = c
b.q = n
assert d.p.w.w.s.txt == "e"