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

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

class C:
    def __init__(self, txt: str):
        self.s: H = None
        self.u: A = None
        self.q: F = None
        self.x: A = None
        self.o: F = None
        self.z: D = None
        self.r: B = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.u: A = None
        self.txt = txt

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.s: H = None
        self.u: A = None
        self.q: F = None
        self.x: A = None
        self.o: F = None
        self.z: D = None
        self.r: B = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.u: A = None
        self.txt = txt

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

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

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

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