class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.r: E = None
        self.p: B = None
        self.q: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.p: E = None
        self.v: C = None
        self.y: B = None
        self.t: E = None
        self.txt = txt

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

m = A("m")
i = B("i")
b = C("b")
e = D("e")
a = E("a")
n = B("n")
d = A("d")

m.u = e
m.r = a
m.p = i
m.q = n
i.p = e
b.s = n
b.v = e
e.p = a
e.t = a
e.v = b
e.y = i
a.p = e
n.p = e
d.u = e
d.r = a
d.p = i
d.q = i
assert b.v.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.r: E = None
        self.p: B = None
        self.q: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.p: E = None
        self.v: C = None
        self.y: B = None
        self.t: E = None
        self.txt = txt

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

m = A("m")
i = B("i")
b = C("b")
e = D("e")
a = E("a")
n = B("n")
d = A("d")

m.u = e
m.r = a
m.p = i
m.q = n
i.p = e
b.s = n
b.v = e
e.p = a
e.t = a
e.v = b
e.y = i
a.p = e
n.p = e
d.u = e
d.r = a
d.p = i
d.q = i
assert b.v.v.v.txt == "e"