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

class B:
    def __init__(self, txt: str):
        self.u: C = None
        self.r: H = None
        self.x: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.w: E = None
        self.x: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: A = None
        self.q: C = None
        self.y: H = None
        self.p: G = None
        self.z: E = None
        self.r: H = None
        self.u: G = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.w: A = None
        self.u: C = None
        self.s: D = None
        self.t: C = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.r: C = None
        self.v: G = None
        self.p: A = None
        self.w: B = None
        self.txt = txt

h = A("h")
g = B("g")
m = C("m")
d = D("d")
a = E("a")
b = F("b")
i = G("i")
f = H("f")

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

class B:
    def __init__(self, txt: str):
        self.u: C = None
        self.r: H = None
        self.x: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.w: E = None
        self.x: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: A = None
        self.q: C = None
        self.y: H = None
        self.p: G = None
        self.z: E = None
        self.r: H = None
        self.u: G = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.w: A = None
        self.u: C = None
        self.s: D = None
        self.t: C = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.r: C = None
        self.v: G = None
        self.p: A = None
        self.w: B = None
        self.txt = txt

h = A("h")
g = B("g")
m = C("m")
d = D("d")
a = E("a")
b = F("b")
i = G("i")
f = H("f")

h.z = f
h.t = d
g.u = m
g.x = m
g.r = f
m.w = a
m.x = a
d.o = h
d.q = m
d.y = f
d.r = f
d.p = i
d.u = i
d.z = a
a.y = m
a.w = g
b.w = h
b.u = m
b.t = m
b.s = d
i.q = a
i.s = h
f.r = m
f.v = i
f.p = h
f.w = g
assert b.w.z.p.z.v.s.txt == "h"