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

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

class C:
    def __init__(self, txt: str):
        self.y: B = None
        self.q: C = None
        self.r: D = None
        self.txt = txt

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

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

m = A("m")
f = B("f")
g = C("g")
e = D("e")
n = E("n")
c = C("c")
i = E("i")

m.x = f
m.q = i
f.p = g
f.v = e
f.z = e
f.r = e
g.y = f
g.q = c
g.r = e
e.r = n
n.q = m
n.w = e
n.s = e
n.x = i
c.y = f
c.q = g
c.r = e
i.q = m
i.w = e
i.s = e
i.x = n
assert n.q.q.x.s.r.s.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.q: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.y: B = None
        self.q: C = None
        self.r: D = None
        self.txt = txt

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

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

m = A("m")
f = B("f")
g = C("g")
e = D("e")
n = E("n")
c = C("c")
i = E("i")

m.x = f
m.q = i
f.p = g
f.v = e
f.z = e
f.r = e
g.y = f
g.q = c
g.r = e
e.r = n
n.q = m
n.w = e
n.s = e
n.x = i
c.y = f
c.q = g
c.r = e
i.q = m
i.w = e
i.s = e
i.x = n
assert n.q.q.x.s.r.s.txt == "e"