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

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

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

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

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

m = A("m")
i = B("i")
a = C("a")
c = D("c")
b = E("b")
l = C("l")

m.p = i
m.s = i
m.v = c
m.t = c
i.r = b
i.v = c
i.q = c
i.s = a
i.t = m
a.o = c
c.t = b
c.r = b
c.u = m
c.s = m
c.p = i
b.q = i
l.o = c
assert a.o.s.s.r.q.s.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.v: D = None
        self.t: D = None
        self.s: B = None
        self.txt = txt

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

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

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

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

m = A("m")
i = B("i")
a = C("a")
c = D("c")
b = E("b")
l = C("l")

m.p = i
m.s = i
m.v = c
m.t = c
i.r = b
i.v = c
i.q = c
i.s = a
i.t = m
a.o = c
c.t = b
c.r = b
c.u = m
c.s = m
c.p = i
b.q = i
l.o = c
assert a.o.s.s.r.q.s.txt == "a"