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

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

class C:
    def __init__(self, txt: str):
        self.t: B = None
        self.s: G = None
        self.txt = txt

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

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

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

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.t: B = None
        self.s: G = None
        self.txt = txt

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

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

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

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

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

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

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