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

class B:
    def __init__(self, txt: str):
        self.o: D = None
        self.u: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.w: A = None
        self.z: J = None
        self.x: I = None
        self.r: H = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.s: H = None
        self.r: H = None
        self.t: G = None
        self.z: H = None
        self.o: I = None
        self.x: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.u: H = None
        self.p: A = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.u: J = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.u: G = None
        self.y: C = None
        self.p: G = None
        self.v: C = None
        self.w: B = None
        self.txt = txt

class J:
    def __init__(self, txt: str):
        self.p: H = None
        self.r: E = None
        self.z: E = None
        self.t: D = None
        self.txt = txt

l = A("l")
h = B("h")
e = C("e")
g = D("g")
i = E("i")
c = F("c")
f = G("f")
k = H("k")
n = I("n")
m = J("m")

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

class B:
    def __init__(self, txt: str):
        self.o: D = None
        self.u: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.w: A = None
        self.z: J = None
        self.x: I = None
        self.r: H = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.s: H = None
        self.r: H = None
        self.t: G = None
        self.z: H = None
        self.o: I = None
        self.x: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.u: H = None
        self.p: A = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.u: J = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.u: G = None
        self.y: C = None
        self.p: G = None
        self.v: C = None
        self.w: B = None
        self.txt = txt

class J:
    def __init__(self, txt: str):
        self.p: H = None
        self.r: E = None
        self.z: E = None
        self.t: D = None
        self.txt = txt

l = A("l")
h = B("h")
e = C("e")
g = D("g")
i = E("i")
c = F("c")
f = G("f")
k = H("k")
n = I("n")
m = J("m")

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