class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.o: C = None
        self.r: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.v: B = None
        self.s: A = None
        self.x: E = None
        self.y: E = None
        self.txt = txt

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.v: B = None
        self.s: A = None
        self.x: E = None
        self.y: E = None
        self.txt = txt

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

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

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

b.u = n
b.o = n
b.r = n
m.o = b
m.p = k
n.v = m
n.s = b
n.x = i
n.y = i
k.z = m
k.y = i
k.r = b
i.w = n
i.y = n
i.q = k
i.u = b
i.x = m
assert m.p.r.u.txt == "n"