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

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

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

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

class E:
    def __init__(self, txt: str):
        self.s: D = None
        self.q: C = None
        self.w: F = None
        self.o: A = None
        self.p: A = None
        self.txt = txt

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

e = A("e")
h = B("h")
m = C("m")
f = D("f")
k = E("k")
d = F("d")

e.w = m
e.q = m
e.x = f
e.s = f
h.y = e
h.p = d
h.w = f
m.z = f
f.q = m
k.s = f
k.q = m
k.w = d
k.o = e
k.p = e
d.o = h
d.y = h
d.w = m
d.z = k
assert k.w.w.z.q.z.q.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.x: D = None
        self.q: C = None
        self.s: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.s: D = None
        self.q: C = None
        self.w: F = None
        self.o: A = None
        self.p: A = None
        self.txt = txt

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

e = A("e")
h = B("h")
m = C("m")
f = D("f")
k = E("k")
d = F("d")

e.w = m
e.q = m
e.x = f
e.s = f
h.y = e
h.p = d
h.w = f
m.z = f
f.q = m
k.s = f
k.q = m
k.w = d
k.o = e
k.p = e
d.o = h
d.y = h
d.w = m
d.z = k
assert k.w.w.z.q.z.q.txt == "m"