class A:
    def __init__(self, txt: str):
        self.p: I = None
        self.q: I = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.z: F = None
        self.u: F = None
        self.v: D = None
        self.o: I = None
        self.p: I = None
        self.w: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: B = None
        self.y: B = None
        self.x: G = None
        self.s: C = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.z: I = None
        self.w: A = None
        self.txt = txt

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

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

class I:
    def __init__(self, txt: str):
        self.o: F = None
        self.s: H = None
        self.w: H = None
        self.txt = txt

class J:
    def __init__(self, txt: str):
        self.z: D = None
        self.o: I = None
        self.r: E = None
        self.y: D = None
        self.t: G = None
        self.x: G = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.z: F = None
        self.u: F = None
        self.v: D = None
        self.o: I = None
        self.p: I = None
        self.w: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: B = None
        self.y: B = None
        self.x: G = None
        self.s: C = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.z: I = None
        self.w: A = None
        self.txt = txt

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

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

class I:
    def __init__(self, txt: str):
        self.o: F = None
        self.s: H = None
        self.w: H = None
        self.txt = txt

class J:
    def __init__(self, txt: str):
        self.z: D = None
        self.o: I = None
        self.r: E = None
        self.y: D = None
        self.t: G = None
        self.x: G = None
        self.txt = txt

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

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