class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.u: I = None
        self.r: G = None
        self.s: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: I = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.u: D = None
        self.y: C = None
        self.z: B = None
        self.x: D = None
        self.s: G = None
        self.o: G = None
        self.w: D = None
        self.t: C = None
        self.v: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.q: H = None
        self.x: E = None
        self.y: A = None
        self.r: J = None
        self.txt = txt

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

class I:
    def __init__(self, txt: str):
        self.x: J = None
        self.txt = txt

class J:
    def __init__(self, txt: str):
        self.v: C = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.w: I = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.u: D = None
        self.y: C = None
        self.z: B = None
        self.x: D = None
        self.s: G = None
        self.o: G = None
        self.w: D = None
        self.t: C = None
        self.v: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.q: H = None
        self.x: E = None
        self.y: A = None
        self.r: J = None
        self.txt = txt

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

class I:
    def __init__(self, txt: str):
        self.x: J = None
        self.txt = txt

class J:
    def __init__(self, txt: str):
        self.v: C = None
        self.txt = txt

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

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