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

class B:
    def __init__(self, txt: str):
        self.z: F = None
        self.s: E = None
        self.v: F = None
        self.p: E = None
        self.x: A = None
        self.o: D = None
        self.txt = txt

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

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

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

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

n = A("n")
a = B("a")
e = C("e")
h = D("h")
k = E("k")
b = F("b")

n.q = b
a.z = b
a.v = b
a.s = k
a.p = k
a.x = n
a.o = h
e.q = h
h.u = k
h.o = a
h.p = e
h.z = b
k.s = a
b.z = a
b.u = k
b.w = k
assert n.q.z.v.w.s.x.txt == "
class A:
    def __init__(self, txt: str):
        self.q: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: F = None
        self.s: E = None
        self.v: F = None
        self.p: E = None
        self.x: A = None
        self.o: D = None
        self.txt = txt

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

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

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

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

n = A("n")
a = B("a")
e = C("e")
h = D("h")
k = E("k")
b = F("b")

n.q = b
a.z = b
a.v = b
a.s = k
a.p = k
a.x = n
a.o = h
e.q = h
h.u = k
h.o = a
h.p = e
h.z = b
k.s = a
b.z = a
b.u = k
b.w = k
assert n.q.z.v.w.s.x.txt == "n"