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

class B:
    def __init__(self, txt: str):
        self.r: G = None
        self.w: D = None
        self.z: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.q: B = None
        self.v: B = None
        self.p: G = None
        self.r: E = None
        self.o: A = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.s: F = None
        self.z: D = None
        self.u: A = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.r: G = None
        self.w: D = None
        self.z: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.q: B = None
        self.v: B = None
        self.p: G = None
        self.r: E = None
        self.o: A = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.s: F = None
        self.z: D = None
        self.u: A = None
        self.txt = txt

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

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