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

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

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

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

class E:
    def __init__(self, txt: str):
        self.z: A = None
        self.s: H = None
        self.u: G = None
        self.q: D = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.s: A = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.z: A = None
        self.txt = txt

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.z: A = None
        self.s: H = None
        self.u: G = None
        self.q: D = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.s: A = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.z: A = None
        self.txt = txt

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

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