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

class B:
    def __init__(self, txt: str):
        self.x: F = None
        self.z: H = None
        self.q: A = None
        self.u: I = None
        self.o: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.z: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.v: D = None
        self.q: D = None
        self.s: I = None
        self.o: B = None
        self.u: G = None
        self.p: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: D = None
        self.y: H = None
        self.s: E = None
        self.w: A = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.t: E = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.w: G = None
        self.o: E = None
        self.q: E = None
        self.p: D = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.x: F = None
        self.z: H = None
        self.q: A = None
        self.u: I = None
        self.o: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.z: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.v: D = None
        self.q: D = None
        self.s: I = None
        self.o: B = None
        self.u: G = None
        self.p: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: D = None
        self.y: H = None
        self.s: E = None
        self.w: A = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.t: E = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.w: G = None
        self.o: E = None
        self.q: E = None
        self.p: D = None
        self.txt = txt

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

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