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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.p: D = None
        self.q: E = None
        self.o: C = None
        self.y: E = None
        self.z: E = None
        self.r: H = None
        self.u: B = None
        self.w: C = None
        self.txt = txt

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

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

m = A("m")
f = B("f")
n = C("n")
e = D("e")
h = E("h")
g = F("g")
j = G("j")
d = H("d")
c = G("c")

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.p: D = None
        self.q: E = None
        self.o: C = None
        self.y: E = None
        self.z: E = None
        self.r: H = None
        self.u: B = None
        self.w: C = None
        self.txt = txt

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

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

m = A("m")
f = B("f")
n = C("n")
e = D("e")
h = E("h")
g = F("g")
j = G("j")
d = H("d")
c = G("c")

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