class A:
    def __init__(self, txt: str):
        self.t: G = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: C = None
        self.z: A = None
        self.y: C = None
        self.x: H = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: B = None
        self.p: B = None
        self.t: D = None
        self.w: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.s: C = None
        self.t: H = None
        self.v: F = None
        self.r: F = None
        self.o: H = None
        self.txt = txt

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.t: C = None
        self.z: A = None
        self.y: C = None
        self.x: H = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: B = None
        self.p: B = None
        self.t: D = None
        self.w: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.s: C = None
        self.t: H = None
        self.v: F = None
        self.r: F = None
        self.o: H = None
        self.txt = txt

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

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

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

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

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