class A:
    def __init__(self, txt: str):
        self.s: E = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.q: C = None
        self.u: A = None
        self.r: C = None
        self.v: I = None
        self.s: C = None
        self.txt = txt

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

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

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

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

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.q: C = None
        self.u: A = None
        self.r: C = None
        self.v: I = None
        self.s: C = None
        self.txt = txt

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

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

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

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

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