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

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

class C:
    def __init__(self, txt: str):
        self.x: F = None
        self.v: B = None
        self.w: A = None
        self.p: B = None
        self.s: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.y: B = None
        self.q: F = None
        self.z: F = None
        self.w: A = None
        self.txt = txt

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

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

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

m.q = a
m.w = a
i.q = n
b.x = l
b.v = i
b.p = i
b.s = i
b.w = m
n.y = i
n.q = l
n.z = l
n.w = m
a.z = m
l.s = a
l.r = m
l.z = n
assert b.w.w.z.w.z.w.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.w: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.x: F = None
        self.v: B = None
        self.w: A = None
        self.p: B = None
        self.s: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.y: B = None
        self.q: F = None
        self.z: F = None
        self.w: A = None
        self.txt = txt

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

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

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

m.q = a
m.w = a
i.q = n
b.x = l
b.v = i
b.p = i
b.s = i
b.w = m
n.y = i
n.q = l
n.z = l
n.w = m
a.z = m
l.s = a
l.r = m
l.z = n
assert b.w.w.z.w.z.w.txt == "a"