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

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

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

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

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

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

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

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

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

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

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

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

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