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

class B:
    def __init__(self, txt: str):
        self.s: G = None
        self.z: D = None
        self.r: F = None
        self.v: A = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.t: A = None
        self.q: B = None
        self.p: B = None
        self.y: G = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.u: H = None
        self.q: C = None
        self.txt = txt

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

n = A("n")
a = B("a")
c = C("c")
k = D("k")
b = E("b")
i = F("i")
l = G("l")
h = H("h")
m = F("m")

n.u = h
n.z = k
a.s = l
a.z = k
a.r = i
a.v = n
c.y = a
c.s = b
k.z = a
k.x = a
b.t = n
b.q = a
b.p = a
b.y = l
i.v = k
i.t = l
l.u = h
l.q = c
h.v = a
h.r = a
h.p = l
h.q = l
h.u = n
m.v = k
m.t = l
assert n.z.z.r.v.txt == "
class A:
    def __init__(self, txt: str):
        self.u: H = None
        self.z: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: G = None
        self.z: D = None
        self.r: F = None
        self.v: A = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.t: A = None
        self.q: B = None
        self.p: B = None
        self.y: G = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.u: H = None
        self.q: C = None
        self.txt = txt

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

n = A("n")
a = B("a")
c = C("c")
k = D("k")
b = E("b")
i = F("i")
l = G("l")
h = H("h")
m = F("m")

n.u = h
n.z = k
a.s = l
a.z = k
a.r = i
a.v = n
c.y = a
c.s = b
k.z = a
k.x = a
b.t = n
b.q = a
b.p = a
b.y = l
i.v = k
i.t = l
l.u = h
l.q = c
h.v = a
h.r = a
h.p = l
h.q = l
h.u = n
m.v = k
m.t = l
assert n.z.z.r.v.txt == "k"