class A:
    def __init__(self, txt: str):
        self.r: J = None
        self.u: H = None
        self.q: F = None
        self.v: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: E = None
        self.q: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: J = None
        self.p: I = None
        self.s: G = None
        self.z: I = None
        self.x: H = None
        self.u: H = None
        self.w: G = None
        self.r: I = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: F = None
        self.s: H = None
        self.t: H = None
        self.w: H = None
        self.y: H = None
        self.p: H = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.r: I = None
        self.u: B = None
        self.s: J = None
        self.w: F = None
        self.z: D = None
        self.y: I = None
        self.v: C = None
        self.x: F = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.t: G = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.p: D = None
        self.v: A = None
        self.y: F = None
        self.r: A = None
        self.o: J = None
        self.w: H = None
        self.txt = txt

class J:
    def __init__(self, txt: str):
        self.t: C = None
        self.u: H = None
        self.v: A = None
        self.p: H = None
        self.z: H = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.s: E = None
        self.q: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: J = None
        self.p: I = None
        self.s: G = None
        self.z: I = None
        self.x: H = None
        self.u: H = None
        self.w: G = None
        self.r: I = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: F = None
        self.s: H = None
        self.t: H = None
        self.w: H = None
        self.y: H = None
        self.p: H = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.r: I = None
        self.u: B = None
        self.s: J = None
        self.w: F = None
        self.z: D = None
        self.y: I = None
        self.v: C = None
        self.x: F = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.t: G = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.p: D = None
        self.v: A = None
        self.y: F = None
        self.r: A = None
        self.o: J = None
        self.w: H = None
        self.txt = txt

class J:
    def __init__(self, txt: str):
        self.t: C = None
        self.u: H = None
        self.v: A = None
        self.p: H = None
        self.z: H = None
        self.txt = txt

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

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