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

class B:
    def __init__(self, txt: str):
        self.z: A = None
        self.w: D = None
        self.v: D = None
        self.o: E = None
        self.u: D = None
        self.txt = txt

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

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

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

j = A("j")
i = B("i")
m = C("m")
b = D("b")
a = E("a")

j.p = b
j.x = a
j.s = a
j.v = a
i.z = j
i.w = b
i.v = b
i.u = b
i.o = a
m.p = j
b.p = i
b.o = i
b.t = i
b.v = i
b.r = m
a.x = j
a.u = m
a.w = b
assert b.r.p.v.u.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.x: E = None
        self.s: E = None
        self.v: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: A = None
        self.w: D = None
        self.v: D = None
        self.o: E = None
        self.u: D = None
        self.txt = txt

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

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

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

j = A("j")
i = B("i")
m = C("m")
b = D("b")
a = E("a")

j.p = b
j.x = a
j.s = a
j.v = a
i.z = j
i.w = b
i.v = b
i.u = b
i.o = a
m.p = j
b.p = i
b.o = i
b.t = i
b.v = i
b.r = m
a.x = j
a.u = m
a.w = b
assert b.r.p.v.u.txt == "m"