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

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

class C:
    def __init__(self, txt: str):
        self.o: J = None
        self.y: B = None
        self.t: A = None
        self.u: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.w: H = None
        self.r: H = None
        self.p: J = None
        self.s: F = None
        self.z: D = None
        self.y: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: B = None
        self.v: G = None
        self.r: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.p: D = None
        self.x: H = None
        self.q: C = None
        self.u: B = None
        self.t: C = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.s: F = None
        self.txt = txt

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.o: J = None
        self.y: B = None
        self.t: A = None
        self.u: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.w: H = None
        self.r: H = None
        self.p: J = None
        self.s: F = None
        self.z: D = None
        self.y: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: B = None
        self.v: G = None
        self.r: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.p: D = None
        self.x: H = None
        self.q: C = None
        self.u: B = None
        self.t: C = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.s: F = None
        self.txt = txt

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

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

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

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