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

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

class C:
    def __init__(self, txt: str):
        self.y: E = None
        self.u: F = None
        self.t: E = None
        self.q: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: G = None
        self.x: C = None
        self.z: G = None
        self.y: E = None
        self.u: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.w: F = None
        self.y: F = None
        self.s: C = None
        self.p: A = None
        self.z: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: F = None
        self.x: G = None
        self.w: C = None
        self.v: C = None
        self.u: G = None
        self.q: F = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.r: D = None
        self.z: D = None
        self.o: C = None
        self.s: C = None
        self.t: D = None
        self.txt = txt

n = A("n")
a = B("a")
d = C("d")
i = D("i")
m = E("m")
e = F("e")
g = G("g")
h = F("h")

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

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

class C:
    def __init__(self, txt: str):
        self.y: E = None
        self.u: F = None
        self.t: E = None
        self.q: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: G = None
        self.x: C = None
        self.z: G = None
        self.y: E = None
        self.u: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.w: F = None
        self.y: F = None
        self.s: C = None
        self.p: A = None
        self.z: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: F = None
        self.x: G = None
        self.w: C = None
        self.v: C = None
        self.u: G = None
        self.q: F = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.r: D = None
        self.z: D = None
        self.o: C = None
        self.s: C = None
        self.t: D = None
        self.txt = txt

n = A("n")
a = B("a")
d = C("d")
i = D("i")
m = E("m")
e = F("e")
g = G("g")
h = F("h")

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