class A:
    def __init__(self, txt: str):
        self.v: E = None
        self.w: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: H = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: A = None
        self.t: H = None
        self.v: B = None
        self.o: F = None
        self.s: F = None
        self.w: F = None
        self.txt = txt

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

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

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

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

class H:
    def __init__(self, txt: str):
        self.r: E = None
        self.s: C = None
        self.t: A = None
        self.w: E = None
        self.x: B = None
        self.q: A = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.q: H = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: A = None
        self.t: H = None
        self.v: B = None
        self.o: F = None
        self.s: F = None
        self.w: F = None
        self.txt = txt

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

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

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

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

class H:
    def __init__(self, txt: str):
        self.r: E = None
        self.s: C = None
        self.t: A = None
        self.w: E = None
        self.x: B = None
        self.q: A = None
        self.txt = txt

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

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