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

class B:
    def __init__(self, txt: str):
        self.z: A = None
        self.s: C = None
        self.t: E = None
        self.txt = txt

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

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

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

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

e.t = n
e.p = m
n.z = e
n.s = a
n.t = m
a.o = e
c.v = n
c.z = a
c.o = a
c.q = m
m.x = a
m.t = e
m.u = n
assert n.s.o.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.p: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: A = None
        self.s: C = None
        self.t: E = None
        self.txt = txt

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

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

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

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

e.t = n
e.p = m
n.z = e
n.s = a
n.t = m
a.o = e
c.v = n
c.z = a
c.o = a
c.q = m
m.x = a
m.t = e
m.u = n
assert n.s.o.t.t.txt == "m"