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

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

class C:
    def __init__(self, txt: str):
        self.s: A = None
        self.u: J = None
        self.v: D = None
        self.q: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.z: G = None
        self.w: H = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: G = None
        self.o: H = None
        self.w: F = None
        self.x: G = None
        self.z: I = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.y: H = None
        self.z: E = None
        self.o: I = None
        self.u: H = None
        self.w: J = None
        self.r: A = None
        self.t: D = None
        self.x: F = None
        self.txt = txt

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

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

class J:
    def __init__(self, txt: str):
        self.o: F = None
        self.y: I = None
        self.w: H = None
        self.x: B = None
        self.q: C = None
        self.r: H = None
        self.u: H = None
        self.s: I = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.s: A = None
        self.u: J = None
        self.v: D = None
        self.q: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.z: G = None
        self.w: H = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: G = None
        self.o: H = None
        self.w: F = None
        self.x: G = None
        self.z: I = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.y: H = None
        self.z: E = None
        self.o: I = None
        self.u: H = None
        self.w: J = None
        self.r: A = None
        self.t: D = None
        self.x: F = None
        self.txt = txt

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

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

class J:
    def __init__(self, txt: str):
        self.o: F = None
        self.y: I = None
        self.w: H = None
        self.x: B = None
        self.q: C = None
        self.r: H = None
        self.u: H = None
        self.s: I = None
        self.txt = txt

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

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