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

class B:
    def __init__(self, txt: str):
        self.w: D = None
        self.r: C = None
        self.u: C = None
        self.v: A = None
        self.q: C = None
        self.x: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.z: B = None
        self.s: D = None
        self.p: A = None
        self.u: D = None
        self.q: D = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

m = A("m")
e = B("e")
n = C("n")
g = D("g")
i = E("i")
a = F("a")

m.q = g
e.w = g
e.r = n
e.u = n
e.q = n
e.x = n
e.v = m
n.z = e
n.s = g
n.u = g
n.q = g
n.p = m
g.y = i
g.w = m
g.x = a
g.s = a
i.r = m
i.w = n
i.o = g
i.z = g
i.q = e
i.y = e
a.s = e
assert i.w.z.v.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: D = None
        self.r: C = None
        self.u: C = None
        self.v: A = None
        self.q: C = None
        self.x: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.z: B = None
        self.s: D = None
        self.p: A = None
        self.u: D = None
        self.q: D = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

m = A("m")
e = B("e")
n = C("n")
g = D("g")
i = E("i")
a = F("a")

m.q = g
e.w = g
e.r = n
e.u = n
e.q = n
e.x = n
e.v = m
n.z = e
n.s = g
n.u = g
n.q = g
n.p = m
g.y = i
g.w = m
g.x = a
g.s = a
i.r = m
i.w = n
i.o = g
i.z = g
i.q = e
i.y = e
a.s = e
assert i.w.z.v.txt == "m"