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

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

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

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

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

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

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

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

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

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

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

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

a.t = m
a.x = h
m.q = n
m.x = a
n.w = m
n.o = m
n.z = h
n.y = h
c.p = n
c.o = n
c.v = n
c.r = a
c.s = a
h.q = n
h.y = n
h.u = n
h.v = m
h.o = c
assert h.o.s.t.q.txt == "n"