class A:
    def __init__(self, txt: str):
        self.r: E = None
        self.p: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: H = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.w: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.p: H = None
        self.y: C = None
        self.o: A = None
        self.q: F = None
        self.x: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: B = None
        self.z: B = None
        self.t: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.q: D = None
        self.y: E = None
        self.s: F = None
        self.u: D = None
        self.v: D = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.w: G = None
        self.s: A = None
        self.o: D = None
        self.z: G = None
        self.y: C = None
        self.t: A = None
        self.u: C = None
        self.q: J = None
        self.v: B = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.q: B = None
        self.t: H = None
        self.w: G = None
        self.p: J = None
        self.z: G = None
        self.y: A = None
        self.o: J = None
        self.u: C = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.x: H = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.w: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.p: H = None
        self.y: C = None
        self.o: A = None
        self.q: F = None
        self.x: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: B = None
        self.z: B = None
        self.t: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.q: D = None
        self.y: E = None
        self.s: F = None
        self.u: D = None
        self.v: D = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.w: G = None
        self.s: A = None
        self.o: D = None
        self.z: G = None
        self.y: C = None
        self.t: A = None
        self.u: C = None
        self.q: J = None
        self.v: B = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.q: B = None
        self.t: H = None
        self.w: G = None
        self.p: J = None
        self.z: G = None
        self.y: A = None
        self.o: J = None
        self.u: C = None
        self.txt = txt

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

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

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