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

class B:
    def __init__(self, txt: str):
        self.w: C = None
        self.r: I = None
        self.q: E = None
        self.u: H = None
        self.z: G = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.q: J = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.w: G = None
        self.v: B = None
        self.z: C = None
        self.q: B = None
        self.p: G = None
        self.r: B = None
        self.o: J = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.t: C = None
        self.q: I = None
        self.u: I = None
        self.v: E = None
        self.s: B = None
        self.x: F = None
        self.p: B = None
        self.r: D = None
        self.z: C = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.u: J = None
        self.p: B = None
        self.x: A = None
        self.v: D = None
        self.txt = txt

class J:
    def __init__(self, txt: str):
        self.p: F = None
        self.q: D = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.w: C = None
        self.r: I = None
        self.q: E = None
        self.u: H = None
        self.z: G = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.q: J = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.w: G = None
        self.v: B = None
        self.z: C = None
        self.q: B = None
        self.p: G = None
        self.r: B = None
        self.o: J = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.t: C = None
        self.q: I = None
        self.u: I = None
        self.v: E = None
        self.s: B = None
        self.x: F = None
        self.p: B = None
        self.r: D = None
        self.z: C = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.u: J = None
        self.p: B = None
        self.x: A = None
        self.v: D = None
        self.txt = txt

class J:
    def __init__(self, txt: str):
        self.p: F = None
        self.q: D = None
        self.txt = txt

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

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