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

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: F = None
        self.r: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.t: E = None
        self.y: J = None
        self.u: C = None
        self.r: J = None
        self.s: H = None
        self.x: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.t: F = None
        self.o: C = None
        self.q: D = None
        self.r: H = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.o: B = None
        self.p: G = None
        self.y: G = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.q: E = None
        self.z: D = None
        self.o: H = None
        self.r: A = None
        self.w: A = None
        self.txt = txt

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

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: F = None
        self.r: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.t: E = None
        self.y: J = None
        self.u: C = None
        self.r: J = None
        self.s: H = None
        self.x: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.t: F = None
        self.o: C = None
        self.q: D = None
        self.r: H = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.o: B = None
        self.p: G = None
        self.y: G = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.q: E = None
        self.z: D = None
        self.o: H = None
        self.r: A = None
        self.w: A = None
        self.txt = txt

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

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

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