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

class B:
    def __init__(self, txt: str):
        self.t: G = None
        self.s: J = None
        self.o: G = None
        self.u: H = None
        self.r: J = None
        self.v: D = None
        self.w: F = None
        self.z: E = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.q: B = None
        self.p: F = None
        self.z: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: E = None
        self.w: J = None
        self.r: J = None
        self.t: H = None
        self.z: E = None
        self.y: C = None
        self.v: A = None
        self.txt = txt

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

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

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

class J:
    def __init__(self, txt: str):
        self.z: D = None
        self.t: G = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.t: G = None
        self.s: J = None
        self.o: G = None
        self.u: H = None
        self.r: J = None
        self.v: D = None
        self.w: F = None
        self.z: E = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.q: B = None
        self.p: F = None
        self.z: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: E = None
        self.w: J = None
        self.r: J = None
        self.t: H = None
        self.z: E = None
        self.y: C = None
        self.v: A = None
        self.txt = txt

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

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

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

class J:
    def __init__(self, txt: str):
        self.z: D = None
        self.t: G = None
        self.txt = txt

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

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