class A:
    def __init__(self, txt: str):
        self.v: F = None
        self.p: H = None
        self.x: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: D = None
        self.u: F = None
        self.y: A = None
        self.z: A = None
        self.q: I = None
        self.w: A = None
        self.r: F = None
        self.v: G = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.q: G = None
        self.o: B = None
        self.w: H = None
        self.u: B = None
        self.r: H = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.z: C = None
        self.r: E = None
        self.w: I = None
        self.t: A = None
        self.txt = txt

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

class I:
    def __init__(self, txt: str):
        self.z: A = None
        self.y: E = None
        self.p: B = None
        self.txt = txt

class J:
    def __init__(self, txt: str):
        self.p: G = None
        self.z: A = None
        self.x: C = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.x: D = None
        self.u: F = None
        self.y: A = None
        self.z: A = None
        self.q: I = None
        self.w: A = None
        self.r: F = None
        self.v: G = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.q: G = None
        self.o: B = None
        self.w: H = None
        self.u: B = None
        self.r: H = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.z: C = None
        self.r: E = None
        self.w: I = None
        self.t: A = None
        self.txt = txt

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

class I:
    def __init__(self, txt: str):
        self.z: A = None
        self.y: E = None
        self.p: B = None
        self.txt = txt

class J:
    def __init__(self, txt: str):
        self.p: G = None
        self.z: A = None
        self.x: C = None
        self.txt = txt

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

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