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

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

class C:
    def __init__(self, txt: str):
        self.p: D = None
        self.txt = txt

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

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

n = A("n")
a = B("a")
c = C("c")
e = D("e")
b = E("b")

n.x = e
n.o = e
n.p = a
n.r = b
a.o = n
a.w = b
c.p = e
e.v = b
e.y = b
e.u = a
e.r = n
b.r = a
assert e.v.r.w.txt == "
class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.o: D = None
        self.p: B = None
        self.r: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: D = None
        self.txt = txt

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

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

n = A("n")
a = B("a")
c = C("c")
e = D("e")
b = E("b")

n.x = e
n.o = e
n.p = a
n.r = b
a.o = n
a.w = b
c.p = e
e.v = b
e.y = b
e.u = a
e.r = n
b.r = a
assert e.v.r.w.txt == "b"