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

class B:
    def __init__(self, txt: str):
        self.o: E = None
        self.r: E = None
        self.q: C = None
        self.u: C = None
        self.x: E = None
        self.p: A = None
        self.z: I = None
        self.y: C = None
        self.t: C = None
        self.s: I = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: J = None
        self.x: J = None
        self.y: A = None
        self.p: F = None
        self.u: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.v: J = None
        self.w: J = None
        self.q: D = None
        self.u: C = None
        self.s: D = None
        self.o: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.s: A = None
        self.y: J = None
        self.u: I = None
        self.r: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.z: A = None
        self.v: C = None
        self.p: H = None
        self.y: D = None
        self.t: D = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.v: F = None
        self.p: C = None
        self.w: C = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.o: B = None
        self.r: E = None
        self.x: F = None
        self.w: F = None
        self.txt = txt

class J:
    def __init__(self, txt: str):
        self.w: A = None
        self.v: G = None
        self.txt = txt

a = A("a")
n = B("n")
l = C("l")
h = D("h")
e = E("e")
j = F("j")
g = G("g")
f = H("f")
d = I("d")
k = J("k")

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

class B:
    def __init__(self, txt: str):
        self.o: E = None
        self.r: E = None
        self.q: C = None
        self.u: C = None
        self.x: E = None
        self.p: A = None
        self.z: I = None
        self.y: C = None
        self.t: C = None
        self.s: I = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: J = None
        self.x: J = None
        self.y: A = None
        self.p: F = None
        self.u: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.v: J = None
        self.w: J = None
        self.q: D = None
        self.u: C = None
        self.s: D = None
        self.o: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.s: A = None
        self.y: J = None
        self.u: I = None
        self.r: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.z: A = None
        self.v: C = None
        self.p: H = None
        self.y: D = None
        self.t: D = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.v: F = None
        self.p: C = None
        self.w: C = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.o: B = None
        self.r: E = None
        self.x: F = None
        self.w: F = None
        self.txt = txt

class J:
    def __init__(self, txt: str):
        self.w: A = None
        self.v: G = None
        self.txt = txt

a = A("a")
n = B("n")
l = C("l")
h = D("h")
e = E("e")
j = F("j")
g = G("g")
f = H("f")
d = I("d")
k = J("k")

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