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

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

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

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

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

m = A("m")
l = B("l")
d = C("d")
n = D("n")
a = E("a")
b = D("b")
h = D("h")

m.s = d
l.w = a
l.r = a
d.v = m
d.s = m
n.s = m
n.p = m
n.t = h
a.v = d
b.s = m
b.p = m
b.t = n
h.s = m
h.p = m
h.t = b
assert a.v.v.s.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.txt = txt

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

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

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

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

m = A("m")
l = B("l")
d = C("d")
n = D("n")
a = E("a")
b = D("b")
h = D("h")

m.s = d
l.w = a
l.r = a
d.v = m
d.s = m
n.s = m
n.p = m
n.t = h
a.v = d
b.s = m
b.p = m
b.t = n
h.s = m
h.p = m
h.t = b
assert a.v.v.s.s.s.txt == "d"