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

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

class C:
    def __init__(self, txt: str):
        self.z: I = None
        self.s: E = None
        self.x: B = None
        self.r: A = None
        self.w: E = None
        self.o: I = None
        self.y: B = None
        self.txt = txt

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

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

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

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

class H:
    def __init__(self, txt: str):
        self.x: F = None
        self.r: G = None
        self.p: J = None
        self.v: G = None
        self.u: B = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.x: H = None
        self.z: A = None
        self.w: H = None
        self.o: J = None
        self.txt = txt

class J:
    def __init__(self, txt: str):
        self.o: A = None
        self.t: I = None
        self.s: H = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.z: I = None
        self.s: E = None
        self.x: B = None
        self.r: A = None
        self.w: E = None
        self.o: I = None
        self.y: B = None
        self.txt = txt

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

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

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

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

class H:
    def __init__(self, txt: str):
        self.x: F = None
        self.r: G = None
        self.p: J = None
        self.v: G = None
        self.u: B = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.x: H = None
        self.z: A = None
        self.w: H = None
        self.o: J = None
        self.txt = txt

class J:
    def __init__(self, txt: str):
        self.o: A = None
        self.t: I = None
        self.s: H = None
        self.txt = txt

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

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