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

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: D = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.q: A = None
        self.o: J = None
        self.x: H = None
        self.p: H = None
        self.v: H = None
        self.txt = txt

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

class I:
    def __init__(self, txt: str):
        self.x: A = None
        self.y: H = None
        self.r: B = None
        self.z: E = None
        self.q: F = None
        self.o: H = None
        self.txt = txt

class J:
    def __init__(self, txt: str):
        self.o: A = None
        self.u: C = None
        self.v: C = None
        self.w: B = None
        self.s: I = None
        self.txt = txt

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: D = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.q: A = None
        self.o: J = None
        self.x: H = None
        self.p: H = None
        self.v: H = None
        self.txt = txt

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

class I:
    def __init__(self, txt: str):
        self.x: A = None
        self.y: H = None
        self.r: B = None
        self.z: E = None
        self.q: F = None
        self.o: H = None
        self.txt = txt

class J:
    def __init__(self, txt: str):
        self.o: A = None
        self.u: C = None
        self.v: C = None
        self.w: B = None
        self.s: I = None
        self.txt = txt

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

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