class A:
    def __init__(self, txt: str):
        self.p: G = None
        self.v: D = None
        self.s: G = None
        self.q: F = None
        self.w: H = None
        self.x: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.u: C = None
        self.y: B = None
        self.t: A = None
        self.o: B = None
        self.q: H = None
        self.r: B = None
        self.w: C = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.s: A = None
        self.y: D = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.w: A = None
        self.u: G = None
        self.q: A = None
        self.o: A = None
        self.y: A = None
        self.v: B = None
        self.x: D = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.v: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.u: C = None
        self.y: B = None
        self.t: A = None
        self.o: B = None
        self.q: H = None
        self.r: B = None
        self.w: C = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.s: A = None
        self.y: D = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.w: A = None
        self.u: G = None
        self.q: A = None
        self.o: A = None
        self.y: A = None
        self.v: B = None
        self.x: D = None
        self.txt = txt

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

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