class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.z: F = None
        self.s: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: F = None
        self.q: A = None
        self.t: F = None
        self.y: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.y: A = None
        self.t: E = None
        self.s: G = None
        self.u: F = None
        self.r: F = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.y: E = None
        self.u: C = None
        self.o: D = None
        self.s: E = None
        self.txt = txt

g = A("g")
m = B("m")
f = C("f")
k = D("k")
b = E("b")
e = F("e")
a = G("a")
d = B("d")
n = E("n")

g.o = f
g.z = e
g.s = e
m.t = b
m.q = d
m.r = f
f.p = e
f.t = e
f.q = g
f.y = k
k.y = g
k.t = n
k.s = a
k.u = e
k.r = e
b.p = f
b.z = f
b.o = m
b.s = n
b.r = d
b.v = g
e.s = g
e.q = g
a.y = n
a.u = f
a.o = k
a.s = b
d.t = n
d.q = m
d.r = f
n.p = f
n.z = f
n.o = m
n.s = b
n.r = d
n.v = g
assert m.q.t.v.z.q.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.z: F = None
        self.s: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: F = None
        self.q: A = None
        self.t: F = None
        self.y: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.y: A = None
        self.t: E = None
        self.s: G = None
        self.u: F = None
        self.r: F = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.y: E = None
        self.u: C = None
        self.o: D = None
        self.s: E = None
        self.txt = txt

g = A("g")
m = B("m")
f = C("f")
k = D("k")
b = E("b")
e = F("e")
a = G("a")
d = B("d")
n = E("n")

g.o = f
g.z = e
g.s = e
m.t = b
m.q = d
m.r = f
f.p = e
f.t = e
f.q = g
f.y = k
k.y = g
k.t = n
k.s = a
k.u = e
k.r = e
b.p = f
b.z = f
b.o = m
b.s = n
b.r = d
b.v = g
e.s = g
e.q = g
a.y = n
a.u = f
a.o = k
a.s = b
d.t = n
d.q = m
d.r = f
n.p = f
n.z = f
n.o = m
n.s = b
n.r = d
n.v = g
assert m.q.t.v.z.q.txt == "g"