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

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

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

class D:
    def __init__(self, txt: str):
        self.q: F = None
        self.u: B = None
        self.r: A = None
        self.w: G = None
        self.p: D = None
        self.t: G = None
        self.z: I = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.q: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.q: B = None
        self.x: B = None
        self.t: C = None
        self.y: D = None
        self.txt = txt

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

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

d = A("d")
m = B("m")
a = C("a")
l = D("l")
f = E("f")
k = F("k")
b = G("b")
h = H("h")
c = I("c")
i = D("i")

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

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

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

class D:
    def __init__(self, txt: str):
        self.q: F = None
        self.u: B = None
        self.r: A = None
        self.w: G = None
        self.p: D = None
        self.t: G = None
        self.z: I = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.q: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.q: B = None
        self.x: B = None
        self.t: C = None
        self.y: D = None
        self.txt = txt

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

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

d = A("d")
m = B("m")
a = C("a")
l = D("l")
f = E("f")
k = F("k")
b = G("b")
h = H("h")
c = I("c")
i = D("i")

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