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

class B:
    def __init__(self, txt: str):
        self.v: C = None
        self.x: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: D = None
        self.z: E = None
        self.w: A = None
        self.t: G = None
        self.s: D = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.z: I = None
        self.s: J = None
        self.x: H = None
        self.y: A = None
        self.o: J = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.r: D = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.o: J = None
        self.y: A = None
        self.p: B = None
        self.x: J = None
        self.v: E = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.w: G = None
        self.z: E = None
        self.t: B = None
        self.o: B = None
        self.r: F = None
        self.v: C = None
        self.txt = txt

class J:
    def __init__(self, txt: str):
        self.x: I = None
        self.p: G = None
        self.r: B = None
        self.y: H = None
        self.s: B = None
        self.w: G = None
        self.u: C = None
        self.o: G = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.v: C = None
        self.x: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: D = None
        self.z: E = None
        self.w: A = None
        self.t: G = None
        self.s: D = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.z: I = None
        self.s: J = None
        self.x: H = None
        self.y: A = None
        self.o: J = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.r: D = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.o: J = None
        self.y: A = None
        self.p: B = None
        self.x: J = None
        self.v: E = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.w: G = None
        self.z: E = None
        self.t: B = None
        self.o: B = None
        self.r: F = None
        self.v: C = None
        self.txt = txt

class J:
    def __init__(self, txt: str):
        self.x: I = None
        self.p: G = None
        self.r: B = None
        self.y: H = None
        self.s: B = None
        self.w: G = None
        self.u: C = None
        self.o: G = None
        self.txt = txt

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

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