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

class B:
    def __init__(self, txt: str):
        self.u: E = None
        self.z: B = None
        self.x: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: B = None
        self.z: B = None
        self.y: D = None
        self.w: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.s: E = None
        self.u: A = None
        self.z: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: A = None
        self.z: B = None
        self.txt = txt

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

n.r = d
n.o = b
n.w = i
n.u = c
n.t = c
d.u = c
d.z = m
d.x = b
b.s = m
b.z = m
b.y = i
b.w = n
i.s = c
i.u = n
i.z = n
c.t = n
c.z = m
m.u = c
m.z = d
m.x = b
assert m.z.z.x.s.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.o: C = None
        self.w: D = None
        self.u: E = None
        self.t: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: E = None
        self.z: B = None
        self.x: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: B = None
        self.z: B = None
        self.y: D = None
        self.w: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.s: E = None
        self.u: A = None
        self.z: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: A = None
        self.z: B = None
        self.txt = txt

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

n.r = d
n.o = b
n.w = i
n.u = c
n.t = c
d.u = c
d.z = m
d.x = b
b.s = m
b.z = m
b.y = i
b.w = n
i.s = c
i.u = n
i.z = n
c.t = n
c.z = m
m.u = c
m.z = d
m.x = b
assert m.z.z.x.s.txt == "m"