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

class B:
    def __init__(self, txt: str):
        self.r: D = None
        self.s: F = None
        self.p: F = None
        self.y: D = None
        self.q: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.z: D = None
        self.t: H = None
        self.x: E = None
        self.q: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.z: D = None
        self.u: F = None
        self.x: H = None
        self.t: H = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.z: B = None
        self.o: A = None
        self.p: B = None
        self.q: C = None
        self.v: G = None
        self.w: C = None
        self.txt = txt

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

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

n = A("n")
a = B("a")
k = C("k")
c = D("c")
b = E("b")
h = F("h")
d = G("d")
j = H("j")

n.z = h
a.r = c
a.y = c
a.s = h
a.p = h
a.q = k
k.z = c
k.t = j
k.x = b
k.q = b
c.v = d
c.y = a
c.u = b
c.s = b
c.q = h
c.p = k
c.w = k
b.z = c
b.u = h
b.x = j
b.t = j
h.z = a
h.p = a
h.o = n
h.q = k
h.w = k
h.v = d
d.q = b
j.s = c
j.v = d
j.r = d
j.w = h
j.t = b
assert k.x.u.o.z.o.z.q.txt == "
class A:
    def __init__(self, txt: str):
        self.z: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: D = None
        self.s: F = None
        self.p: F = None
        self.y: D = None
        self.q: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.z: D = None
        self.t: H = None
        self.x: E = None
        self.q: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.z: D = None
        self.u: F = None
        self.x: H = None
        self.t: H = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.z: B = None
        self.o: A = None
        self.p: B = None
        self.q: C = None
        self.v: G = None
        self.w: C = None
        self.txt = txt

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

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

n = A("n")
a = B("a")
k = C("k")
c = D("c")
b = E("b")
h = F("h")
d = G("d")
j = H("j")

n.z = h
a.r = c
a.y = c
a.s = h
a.p = h
a.q = k
k.z = c
k.t = j
k.x = b
k.q = b
c.v = d
c.y = a
c.u = b
c.s = b
c.q = h
c.p = k
c.w = k
b.z = c
b.u = h
b.x = j
b.t = j
h.z = a
h.p = a
h.o = n
h.q = k
h.w = k
h.v = d
d.q = b
j.s = c
j.v = d
j.r = d
j.w = h
j.t = b
assert k.x.u.o.z.o.z.q.txt == "k"