class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: B = None
        self.r: H = None
        self.p: F = None
        self.w: F = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.p: E = None
        self.txt = txt

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: B = None
        self.r: H = None
        self.p: F = None
        self.w: F = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.p: E = None
        self.txt = txt

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

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