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

class B:
    def __init__(self, txt: str):
        self.r: H = None
        self.y: D = None
        self.o: C = None
        self.w: D = None
        self.v: H = None
        self.x: C = None
        self.t: E = None
        self.z: I = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.y: D = None
        self.z: B = None
        self.o: B = None
        self.v: B = None
        self.p: C = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.z: F = None
        self.x: A = None
        self.u: F = None
        self.s: B = None
        self.w: G = None
        self.v: B = None
        self.q: D = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.q: A = None
        self.t: B = None
        self.w: H = None
        self.o: B = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.r: H = None
        self.y: D = None
        self.o: C = None
        self.w: D = None
        self.v: H = None
        self.x: C = None
        self.t: E = None
        self.z: I = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.y: D = None
        self.z: B = None
        self.o: B = None
        self.v: B = None
        self.p: C = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.z: F = None
        self.x: A = None
        self.u: F = None
        self.s: B = None
        self.w: G = None
        self.v: B = None
        self.q: D = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.q: A = None
        self.t: B = None
        self.w: H = None
        self.o: B = None
        self.txt = txt

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

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