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

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

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

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

class E:
    def __init__(self, txt: str):
        self.s: B = None
        self.u: F = None
        self.v: C = None
        self.o: F = None
        self.z: J = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.p: F = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.p: B = None
        self.w: D = None
        self.x: C = None
        self.z: B = None
        self.txt = txt

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

class J:
    def __init__(self, txt: str):
        self.z: C = None
        self.w: H = None
        self.u: C = None
        self.r: D = None
        self.v: A = None
        self.txt = txt

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.s: B = None
        self.u: F = None
        self.v: C = None
        self.o: F = None
        self.z: J = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.p: F = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.p: B = None
        self.w: D = None
        self.x: C = None
        self.z: B = None
        self.txt = txt

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

class J:
    def __init__(self, txt: str):
        self.z: C = None
        self.w: H = None
        self.u: C = None
        self.r: D = None
        self.v: A = None
        self.txt = txt

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

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