class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.s: G = None
        self.r: E = None
        self.w: D = None
        self.x: C = None
        self.q: H = None
        self.u: F = None
        self.v: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.z: G = None
        self.p: C = None
        self.u: G = None
        self.x: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.u: A = None
        self.x: G = None
        self.t: H = None
        self.y: H = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.t: A = None
        self.p: F = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.t: F = None
        self.y: E = None
        self.r: E = None
        self.z: E = None
        self.txt = txt

a = A("a")
m = B("m")
f = C("f")
c = D("c")
h = E("h")
n = F("n")
k = G("k")
d = H("d")

a.p = m
a.s = k
a.r = h
a.v = h
a.w = c
a.x = f
a.q = d
a.u = n
m.q = a
f.s = c
f.w = d
c.z = k
c.u = k
c.p = f
c.x = n
h.u = a
h.x = k
h.t = d
h.y = d
n.o = k
n.q = k
n.y = f
n.z = f
n.p = c
n.s = a
k.t = a
k.p = n
d.t = n
d.y = h
d.r = h
d.z = h
assert n.z.w.t.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.s: G = None
        self.r: E = None
        self.w: D = None
        self.x: C = None
        self.q: H = None
        self.u: F = None
        self.v: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.z: G = None
        self.p: C = None
        self.u: G = None
        self.x: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.u: A = None
        self.x: G = None
        self.t: H = None
        self.y: H = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.t: A = None
        self.p: F = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.t: F = None
        self.y: E = None
        self.r: E = None
        self.z: E = None
        self.txt = txt

a = A("a")
m = B("m")
f = C("f")
c = D("c")
h = E("h")
n = F("n")
k = G("k")
d = H("d")

a.p = m
a.s = k
a.r = h
a.v = h
a.w = c
a.x = f
a.q = d
a.u = n
m.q = a
f.s = c
f.w = d
c.z = k
c.u = k
c.p = f
c.x = n
h.u = a
h.x = k
h.t = d
h.y = d
n.o = k
n.q = k
n.y = f
n.z = f
n.p = c
n.s = a
k.t = a
k.p = n
d.t = n
d.y = h
d.r = h
d.z = h
assert n.z.w.t.txt == "n"