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

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

class C:
    def __init__(self, txt: str):
        self.x: D = None
        self.v: E = None
        self.q: G = None
        self.o: H = None
        self.r: B = None
        self.w: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: C = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.x: A = None
        self.y: D = None
        self.t: C = None
        self.v: A = None
        self.txt = txt

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

h = A("h")
f = B("f")
n = C("n")
j = D("j")
k = E("k")
i = F("i")
e = G("e")
g = H("g")

h.y = n
h.z = i
f.p = e
f.r = g
n.x = j
n.v = k
n.q = e
n.w = e
n.o = g
n.r = f
j.w = n
k.u = e
k.w = e
k.x = f
i.z = k
i.t = f
i.r = h
e.x = h
e.v = h
e.y = j
e.t = n
g.s = k
g.v = f
assert k.u.t.v.x.p.t.x.w.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.z: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.x: D = None
        self.v: E = None
        self.q: G = None
        self.o: H = None
        self.r: B = None
        self.w: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: C = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.x: A = None
        self.y: D = None
        self.t: C = None
        self.v: A = None
        self.txt = txt

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

h = A("h")
f = B("f")
n = C("n")
j = D("j")
k = E("k")
i = F("i")
e = G("e")
g = H("g")

h.y = n
h.z = i
f.p = e
f.r = g
n.x = j
n.v = k
n.q = e
n.w = e
n.o = g
n.r = f
j.w = n
k.u = e
k.w = e
k.x = f
i.z = k
i.t = f
i.r = h
e.x = h
e.v = h
e.y = j
e.t = n
g.s = k
g.v = f
assert k.u.t.v.x.p.t.x.w.txt == "n"