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

class B:
    def __init__(self, txt: str):
        self.z: I = None
        self.x: F = None
        self.y: J = None
        self.p: F = None
        self.w: J = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: I = None
        self.o: H = None
        self.y: E = None
        self.v: I = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.y: B = None
        self.t: H = None
        self.x: G = None
        self.z: H = None
        self.p: B = None
        self.w: H = None
        self.u: I = None
        self.s: H = None
        self.v: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.v: H = None
        self.r: A = None
        self.y: J = None
        self.p: E = None
        self.s: A = None
        self.x: J = None
        self.u: A = None
        self.z: D = None
        self.w: J = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.y: C = None
        self.o: B = None
        self.t: I = None
        self.x: B = None
        self.w: A = None
        self.r: G = None
        self.txt = txt

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

class J:
    def __init__(self, txt: str):
        self.r: G = None
        self.y: I = None
        self.z: I = None
        self.t: C = None
        self.q: E = None
        self.s: G = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.z: I = None
        self.x: F = None
        self.y: J = None
        self.p: F = None
        self.w: J = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: I = None
        self.o: H = None
        self.y: E = None
        self.v: I = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.y: B = None
        self.t: H = None
        self.x: G = None
        self.z: H = None
        self.p: B = None
        self.w: H = None
        self.u: I = None
        self.s: H = None
        self.v: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.v: H = None
        self.r: A = None
        self.y: J = None
        self.p: E = None
        self.s: A = None
        self.x: J = None
        self.u: A = None
        self.z: D = None
        self.w: J = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.y: C = None
        self.o: B = None
        self.t: I = None
        self.x: B = None
        self.w: A = None
        self.r: G = None
        self.txt = txt

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

class J:
    def __init__(self, txt: str):
        self.r: G = None
        self.y: I = None
        self.z: I = None
        self.t: C = None
        self.q: E = None
        self.s: G = None
        self.txt = txt

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

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