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

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

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

class D:
    def __init__(self, txt: str):
        self.v: E = None
        self.z: C = None
        self.x: A = None
        self.y: C = None
        self.txt = txt

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.v: E = None
        self.z: C = None
        self.x: A = None
        self.y: C = None
        self.txt = txt

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

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

n.q = l
n.t = l
l.z = c
l.q = c
l.w = c
c.x = l
a.v = m
a.z = c
a.y = c
a.x = n
m.w = a
m.q = a
m.s = a
m.u = a
m.x = c
assert m.s.v.x.x.z.txt == "c"