class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.q: D = None
        self.o: D = None
        self.x: C = None
        self.s: H = None
        self.y: H = None
        self.z: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.s: A = None
        self.x: F = None
        self.o: C = None
        self.q: G = None
        self.u: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.v: G = None
        self.r: E = None
        self.u: H = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.p: A = None
        self.o: A = None
        self.s: B = None
        self.w: D = None
        self.r: F = None
        self.v: F = None
        self.t: G = None
        self.txt = txt

a = A("a")
m = B("m")
k = C("k")
f = D("f")
e = E("e")
c = F("c")
g = G("g")
b = H("b")
n = H("n")

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.s: A = None
        self.x: F = None
        self.o: C = None
        self.q: G = None
        self.u: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.v: G = None
        self.r: E = None
        self.u: H = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.p: A = None
        self.o: A = None
        self.s: B = None
        self.w: D = None
        self.r: F = None
        self.v: F = None
        self.t: G = None
        self.txt = txt

a = A("a")
m = B("m")
k = C("k")
f = D("f")
e = E("e")
c = F("c")
g = G("g")
b = H("b")
n = H("n")

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