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

class B:
    def __init__(self, txt: str):
        self.v: J = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: F = None
        self.t: A = None
        self.u: H = None
        self.r: F = None
        self.w: H = None
        self.o: G = None
        self.q: I = None
        self.x: J = None
        self.v: J = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.s: E = None
        self.t: J = None
        self.o: B = None
        self.r: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.z: J = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.z: I = None
        self.w: J = None
        self.o: H = None
        self.y: B = None
        self.txt = txt

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

class I:
    def __init__(self, txt: str):
        self.q: H = None
        self.u: A = None
        self.t: D = None
        self.v: G = None
        self.r: H = None
        self.o: C = None
        self.x: E = None
        self.w: E = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.v: J = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: F = None
        self.t: A = None
        self.u: H = None
        self.r: F = None
        self.w: H = None
        self.o: G = None
        self.q: I = None
        self.x: J = None
        self.v: J = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.s: E = None
        self.t: J = None
        self.o: B = None
        self.r: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.z: J = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.z: I = None
        self.w: J = None
        self.o: H = None
        self.y: B = None
        self.txt = txt

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

class I:
    def __init__(self, txt: str):
        self.q: H = None
        self.u: A = None
        self.t: D = None
        self.v: G = None
        self.r: H = None
        self.o: C = None
        self.x: E = None
        self.w: E = None
        self.txt = txt

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

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

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