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

class B:
    def __init__(self, txt: str):
        self.z: A = None
        self.u: E = None
        self.x: A = None
        self.v: E = None
        self.r: I = None
        self.s: I = None
        self.p: I = None
        self.y: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: G = None
        self.q: G = None
        self.v: A = None
        self.u: F = None
        self.t: G = None
        self.txt = txt

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

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

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

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

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

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

h = A("h")
f = B("f")
i = C("i")
k = D("k")
e = E("e")
l = F("l")
d = G("d")
g = H("g")
m = I("m")

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

class B:
    def __init__(self, txt: str):
        self.z: A = None
        self.u: E = None
        self.x: A = None
        self.v: E = None
        self.r: I = None
        self.s: I = None
        self.p: I = None
        self.y: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: G = None
        self.q: G = None
        self.v: A = None
        self.u: F = None
        self.t: G = None
        self.txt = txt

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

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

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

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

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

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

h = A("h")
f = B("f")
i = C("i")
k = D("k")
e = E("e")
l = F("l")
d = G("d")
g = H("g")
m = I("m")

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