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

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

class C:
    def __init__(self, txt: str):
        self.p: B = None
        self.y: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: E = None
        self.x: C = None
        self.w: F = None
        self.r: C = None
        self.z: C = None
        self.q: F = None
        self.txt = txt

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

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

e = A("e")
c = B("c")
b = C("b")
h = D("h")
m = E("m")
a = F("a")

e.w = h
e.z = m
c.w = b
c.z = a
b.p = c
b.y = m
h.v = m
h.x = b
h.r = b
h.z = b
h.w = a
h.q = a
m.z = h
a.o = b
a.y = b
a.z = h
a.u = c
a.w = e
a.x = m
assert a.z.v.z.q.z.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.z: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: B = None
        self.y: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: E = None
        self.x: C = None
        self.w: F = None
        self.r: C = None
        self.z: C = None
        self.q: F = None
        self.txt = txt

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

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

e = A("e")
c = B("c")
b = C("b")
h = D("h")
m = E("m")
a = F("a")

e.w = h
e.z = m
c.w = b
c.z = a
b.p = c
b.y = m
h.v = m
h.x = b
h.r = b
h.z = b
h.w = a
h.q = a
m.z = h
a.o = b
a.y = b
a.z = h
a.u = c
a.w = e
a.x = m
assert a.z.v.z.q.z.txt == "h"