class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.w: I = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: G = None
        self.x: H = None
        self.r: H = None
        self.p: I = None
        self.z: G = None
        self.s: G = None
        self.q: I = None
        self.v: D = None
        self.o: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.o: H = None
        self.u: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.s: F = None
        self.o: B = None
        self.w: F = None
        self.q: C = None
        self.x: I = None
        self.r: A = None
        self.z: I = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.z: C = None
        self.t: F = None
        self.y: B = None
        self.p: H = None
        self.w: B = None
        self.s: A = None
        self.q: C = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.y: C = None
        self.q: F = None
        self.txt = txt

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

class J:
    def __init__(self, txt: str):
        self.o: F = None
        self.u: C = None
        self.s: E = None
        self.x: C = None
        self.txt = txt

a = A("a")
f = B("f")
d = C("d")
b = D("b")
c = E("c")
h = F("h")
l = G("l")
i = H("i")
e = I("e")
j = J("j")

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

class B:
    def __init__(self, txt: str):
        self.y: G = None
        self.x: H = None
        self.r: H = None
        self.p: I = None
        self.z: G = None
        self.s: G = None
        self.q: I = None
        self.v: D = None
        self.o: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.o: H = None
        self.u: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.s: F = None
        self.o: B = None
        self.w: F = None
        self.q: C = None
        self.x: I = None
        self.r: A = None
        self.z: I = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.z: C = None
        self.t: F = None
        self.y: B = None
        self.p: H = None
        self.w: B = None
        self.s: A = None
        self.q: C = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.y: C = None
        self.q: F = None
        self.txt = txt

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

class J:
    def __init__(self, txt: str):
        self.o: F = None
        self.u: C = None
        self.s: E = None
        self.x: C = None
        self.txt = txt

a = A("a")
f = B("f")
d = C("d")
b = D("b")
c = E("c")
h = F("h")
l = G("l")
i = H("i")
e = I("e")
j = J("j")

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