class A:
    def __init__(self, txt: str):
        self.v: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: G = None
        self.u: G = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.w: H = None
        self.p: E = None
        self.r: D = None
        self.v: C = None
        self.s: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.p: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: C = None
        self.t: G = None
        self.v: C = None
        self.w: A = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.p: G = None
        self.o: F = None
        self.s: C = None
        self.q: G = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.x: A = None
        self.t: G = None
        self.w: E = None
        self.r: D = None
        self.v: E = None
        self.y: A = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.o: G = None
        self.u: G = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.w: H = None
        self.p: E = None
        self.r: D = None
        self.v: C = None
        self.s: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.p: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: C = None
        self.t: G = None
        self.v: C = None
        self.w: A = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.p: G = None
        self.o: F = None
        self.s: C = None
        self.q: G = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.x: A = None
        self.t: G = None
        self.w: E = None
        self.r: D = None
        self.v: E = None
        self.y: A = None
        self.txt = txt

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

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