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

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

class C:
    def __init__(self, txt: str):
        self.o: A = None
        self.q: I = None
        self.p: J = None
        self.s: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: H = None
        self.q: B = None
        self.r: F = None
        self.x: C = None
        self.s: F = None
        self.y: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: I = None
        self.x: I = None
        self.q: I = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.s: J = None
        self.q: I = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.y: H = None
        self.p: C = None
        self.t: A = None
        self.z: E = None
        self.q: I = None
        self.txt = txt

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

class I:
    def __init__(self, txt: str):
        self.p: A = None
        self.s: F = None
        self.x: J = None
        self.w: E = None
        self.y: H = None
        self.q: G = None
        self.txt = txt

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.o: A = None
        self.q: I = None
        self.p: J = None
        self.s: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: H = None
        self.q: B = None
        self.r: F = None
        self.x: C = None
        self.s: F = None
        self.y: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: I = None
        self.x: I = None
        self.q: I = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.s: J = None
        self.q: I = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.y: H = None
        self.p: C = None
        self.t: A = None
        self.z: E = None
        self.q: I = None
        self.txt = txt

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

class I:
    def __init__(self, txt: str):
        self.p: A = None
        self.s: F = None
        self.x: J = None
        self.w: E = None
        self.y: H = None
        self.q: G = None
        self.txt = txt

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

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

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