class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.r: E = None
        self.w: 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.w: D = None
        self.r: B = None
        self.z: B = None
        self.t: A = None
        self.p: E = None
        self.txt = txt

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

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

n = A("n")
m = B("m")
i = C("i")
h = D("h")
j = E("j")
f = E("f")

n.u = i
n.r = j
n.w = m
m.p = h
i.w = h
i.r = m
i.z = m
i.t = n
i.p = f
h.y = m
h.v = n
h.p = j
j.s = n
j.y = h
j.r = h
j.x = f
f.s = n
f.y = h
f.r = h
f.x = j
assert m.p.p.x.s.r.s.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.r: E = None
        self.w: 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.w: D = None
        self.r: B = None
        self.z: B = None
        self.t: A = None
        self.p: E = None
        self.txt = txt

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

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

n = A("n")
m = B("m")
i = C("i")
h = D("h")
j = E("j")
f = E("f")

n.u = i
n.r = j
n.w = m
m.p = h
i.w = h
i.r = m
i.z = m
i.t = n
i.p = f
h.y = m
h.v = n
h.p = j
j.s = n
j.y = h
j.r = h
j.x = f
f.s = n
f.y = h
f.r = h
f.x = j
assert m.p.p.x.s.r.s.txt == "n"