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

class B:
    def __init__(self, txt: str):
        self.r: C = None
        self.w: D = None
        self.s: D = None
        self.p: D = None
        self.u: F = None
        self.z: G = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.u: H = None
        self.t: C = None
        self.x: B = None
        self.w: B = None
        self.z: H = None
        self.r: C = None
        self.p: A = None
        self.txt = txt

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

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

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

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

class H:
    def __init__(self, txt: str):
        self.z: G = None
        self.q: E = None
        self.y: E = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.r: C = None
        self.w: D = None
        self.s: D = None
        self.p: D = None
        self.u: F = None
        self.z: G = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.u: H = None
        self.t: C = None
        self.x: B = None
        self.w: B = None
        self.z: H = None
        self.r: C = None
        self.p: A = None
        self.txt = txt

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

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

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

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

class H:
    def __init__(self, txt: str):
        self.z: G = None
        self.q: E = None
        self.y: E = None
        self.txt = txt

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

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