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

class B:
    def __init__(self, txt: str):
        self.z: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.w: F = None
        self.q: B = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.w: E = None
        self.txt = txt

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

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

m.v = i
m.w = k
i.z = h
h.w = n
h.q = i
j.u = i
a.q = i
n.w = a
e.q = i
e.r = d
e.v = a
e.s = h
g.u = i
k.q = i
k.r = d
k.v = d
k.s = h
d.q = i
assert g.u.z.q.z.w.w.q.z.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.w: G = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.w: F = None
        self.q: B = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.w: E = None
        self.txt = txt

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

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

m.v = i
m.w = k
i.z = h
h.w = n
h.q = i
j.u = i
a.q = i
n.w = a
e.q = i
e.r = d
e.v = a
e.s = h
g.u = i
k.q = i
k.r = d
k.v = d
k.s = h
d.q = i
assert g.u.z.q.z.w.w.q.z.txt == "h"