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

class B:
    def __init__(self, txt: str):
        self.x: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: G = None
        self.v: D = None
        self.o: H = None
        self.q: F = None
        self.u: A = None
        self.t: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: E = None
        self.z: G = None
        self.w: H = None
        self.o: C = None
        self.p: C = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.y: H = None
        self.r: F = None
        self.x: B = None
        self.o: D = None
        self.v: H = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.s: C = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.r: H = None
        self.x: B = None
        self.s: F = None
        self.t: A = None
        self.y: H = None
        self.u: F = None
        self.p: G = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.x: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: G = None
        self.v: D = None
        self.o: H = None
        self.q: F = None
        self.u: A = None
        self.t: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: E = None
        self.z: G = None
        self.w: H = None
        self.o: C = None
        self.p: C = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.y: H = None
        self.r: F = None
        self.x: B = None
        self.o: D = None
        self.v: H = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.s: C = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.r: H = None
        self.x: B = None
        self.s: F = None
        self.t: A = None
        self.y: H = None
        self.u: F = None
        self.p: G = None
        self.txt = txt

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

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