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

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

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

class D:
    def __init__(self, txt: str):
        self.p: A = None
        self.y: B = None
        self.w: E = None
        self.u: C = None
        self.r: C = None
        self.v: C = None
        self.z: F = None
        self.txt = txt

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

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

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

c = A("c")
g = B("g")
n = C("n")
h = D("h")
a = E("a")
i = F("i")
k = G("k")
d = G("d")
f = D("f")
b = B("b")

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

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

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

class D:
    def __init__(self, txt: str):
        self.p: A = None
        self.y: B = None
        self.w: E = None
        self.u: C = None
        self.r: C = None
        self.v: C = None
        self.z: F = None
        self.txt = txt

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

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

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

c = A("c")
g = B("g")
n = C("n")
h = D("h")
a = E("a")
i = F("i")
k = G("k")
d = G("d")
f = D("f")
b = B("b")

c.v = a
g.v = b
n.s = c
h.p = c
h.y = g
h.w = a
h.u = n
h.r = n
h.v = n
h.z = i
a.x = n
a.w = g
i.w = g
i.z = n
k.v = a
k.r = n
k.s = n
k.p = n
k.z = d
d.v = a
d.r = n
d.s = n
d.p = n
d.z = k
f.p = c
f.y = g
f.w = a
f.u = n
f.r = n
f.v = n
f.z = i
b.v = g
assert n.s.v.w.v.v.txt == "g"