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

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

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

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

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

a = A("a")
m = B("m")
d = C("d")
e = D("e")
b = E("b")

a.u = d
m.o = d
m.z = e
d.v = b
d.r = e
d.s = m
d.o = a
d.z = a
e.y = a
b.v = e
b.s = a
b.y = a
b.x = d
b.z = d
assert d.r.y.u.r.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

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

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

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

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

a = A("a")
m = B("m")
d = C("d")
e = D("e")
b = E("b")

a.u = d
m.o = d
m.z = e
d.v = b
d.r = e
d.s = m
d.o = a
d.z = a
e.y = a
b.v = e
b.s = a
b.y = a
b.x = d
b.z = d
assert d.r.y.u.r.txt == "e"