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

class B:
    def __init__(self, txt: str):
        self.p: E = None
        self.t: H = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.p: H = None
        self.t: H = None
        self.u: F = None
        self.q: H = None
        self.z: G = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

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

a.v = d
a.t = h
e.p = n
e.t = h
b.r = g
b.w = n
d.v = h
n.p = h
n.t = h
n.q = h
n.u = g
n.z = m
g.o = e
g.p = e
g.u = n
g.v = n
g.w = h
g.r = m
g.y = b
g.q = a
m.w = h
h.t = d
assert a.t.t.v.t.v.t.v.t.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.t: H = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: E = None
        self.t: H = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.p: H = None
        self.t: H = None
        self.u: F = None
        self.q: H = None
        self.z: G = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

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

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