class A:
    def __init__(self, txt: str):
        self.r: G = None
        self.t: H = None
        self.o: H = None
        self.s: H = None
        self.u: B = None
        self.z: G = None
        self.y: E = None
        self.p: B = None
        self.txt = txt

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

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

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

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

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

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

class H:
    def __init__(self, txt: str):
        self.z: D = None
        self.q: F = None
        self.txt = txt

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

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

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

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

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

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

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

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

class H:
    def __init__(self, txt: str):
        self.z: D = None
        self.q: F = None
        self.txt = txt

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

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