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

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

class C:
    def __init__(self, txt: str):
        self.w: A = None
        self.v: G = None
        self.q: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: B = None
        self.r: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: D = None
        self.y: D = None
        self.z: H = None
        self.w: J = None
        self.o: A = None
        self.q: B = None
        self.u: J = None
        self.s: H = None
        self.p: F = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.o: C = None
        self.u: D = None
        self.y: J = None
        self.w: H = None
        self.txt = txt

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

class I:
    def __init__(self, txt: str):
        self.r: B = None
        self.y: D = None
        self.q: D = None
        self.v: E = None
        self.t: C = None
        self.txt = txt

class J:
    def __init__(self, txt: str):
        self.x: G = None
        self.w: B = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.w: A = None
        self.v: G = None
        self.q: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: B = None
        self.r: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: D = None
        self.y: D = None
        self.z: H = None
        self.w: J = None
        self.o: A = None
        self.q: B = None
        self.u: J = None
        self.s: H = None
        self.p: F = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.o: C = None
        self.u: D = None
        self.y: J = None
        self.w: H = None
        self.txt = txt

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

class I:
    def __init__(self, txt: str):
        self.r: B = None
        self.y: D = None
        self.q: D = None
        self.v: E = None
        self.t: C = None
        self.txt = txt

class J:
    def __init__(self, txt: str):
        self.x: G = None
        self.w: B = None
        self.txt = txt

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

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