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

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

class C:
    def __init__(self, txt: str):
        self.r: A = None
        self.y: G = None
        self.v: E = None
        self.u: D = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.x: E = None
        self.r: J = None
        self.z: J = None
        self.s: I = None
        self.txt = txt

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

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

class I:
    def __init__(self, txt: str):
        self.x: D = None
        self.s: E = None
        self.txt = txt

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.r: A = None
        self.y: G = None
        self.v: E = None
        self.u: D = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.x: E = None
        self.r: J = None
        self.z: J = None
        self.s: I = None
        self.txt = txt

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

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

class I:
    def __init__(self, txt: str):
        self.x: D = None
        self.s: E = None
        self.txt = txt

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

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

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