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

class B:
    def __init__(self, txt: str):
        self.w: C = None
        self.p: G = None
        self.y: G = None
        self.u: G = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: F = None
        self.v: F = None
        self.x: D = None
        self.w: A = None
        self.z: H = None
        self.o: E = None
        self.t: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: H = None
        self.p: F = None
        self.y: B = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.q: I = None
        self.v: E = None
        self.w: B = None
        self.s: C = None
        self.t: J = None
        self.txt = txt

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

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.w: C = None
        self.p: G = None
        self.y: G = None
        self.u: G = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: F = None
        self.v: F = None
        self.x: D = None
        self.w: A = None
        self.z: H = None
        self.o: E = None
        self.t: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: H = None
        self.p: F = None
        self.y: B = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.q: I = None
        self.v: E = None
        self.w: B = None
        self.s: C = None
        self.t: J = None
        self.txt = txt

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

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

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

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

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

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