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

class B:
    def __init__(self, txt: str):
        self.s: I = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.x: F = None
        self.q: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: B = None
        self.s: C = None
        self.x: G = None
        self.o: A = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.x: C = None
        self.v: H = None
        self.q: A = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.q: D = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.s: G = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.s: I = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.x: F = None
        self.q: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: B = None
        self.s: C = None
        self.x: G = None
        self.o: A = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.x: C = None
        self.v: H = None
        self.q: A = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.q: D = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.s: G = None
        self.txt = txt

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

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