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

class B:
    def __init__(self, txt: str):
        self.u: C = None
        self.p: H = None
        self.z: A = None
        self.t: H = 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.t: B = None
        self.r: G = None
        self.o: A = None
        self.z: E = None
        self.x: H = None
        self.p: F = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.p: B = None
        self.v: C = None
        self.q: D = None
        self.t: F = None
        self.w: E = None
        self.o: B = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.u: C = None
        self.p: H = None
        self.z: A = None
        self.t: H = 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.t: B = None
        self.r: G = None
        self.o: A = None
        self.z: E = None
        self.x: H = None
        self.p: F = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.p: B = None
        self.v: C = None
        self.q: D = None
        self.t: F = None
        self.w: E = None
        self.o: B = None
        self.txt = txt

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

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