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

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

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

class D:
    def __init__(self, txt: str):
        self.o: A = None
        self.v: B = None
        self.x: B = None
        self.txt = txt

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

m = A("m")
n = B("n")
e = C("e")
k = D("k")
a = E("a")

m.r = k
m.w = e
m.z = a
n.o = k
n.y = k
n.w = k
n.u = m
n.x = a
e.x = m
k.o = m
k.v = n
k.x = n
a.u = m
a.p = m
a.z = k
a.q = k
assert k.o.r.x.u.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.w: C = None
        self.z: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.o: A = None
        self.v: B = None
        self.x: B = None
        self.txt = txt

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

m = A("m")
n = B("n")
e = C("e")
k = D("k")
a = E("a")

m.r = k
m.w = e
m.z = a
n.o = k
n.y = k
n.w = k
n.u = m
n.x = a
e.x = m
k.o = m
k.v = n
k.x = n
a.u = m
a.p = m
a.z = k
a.q = k
assert k.o.r.x.u.txt == "m"