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

class B:
    def __init__(self, txt: str):
        self.q: A = None
        self.z: C = None
        self.u: B = None
        self.txt = txt

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

h = A("h")
n = B("n")
k = C("k")
j = A("j")
l = C("l")
b = B("b")
m = C("m")
a = A("a")
c = A("c")
i = C("i")

h.x = c
n.q = j
n.z = l
n.u = b
k.v = n
k.o = a
k.z = h
j.x = h
l.v = b
l.o = j
l.z = c
b.q = c
b.z = k
b.u = n
m.v = b
m.o = j
m.z = a
a.x = j
c.x = h
i.v = b
i.o = a
i.z = j
assert a.x.x.x.x.x.x.x.x.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: A = None
        self.z: C = None
        self.u: B = None
        self.txt = txt

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

h = A("h")
n = B("n")
k = C("k")
j = A("j")
l = C("l")
b = B("b")
m = C("m")
a = A("a")
c = A("c")
i = C("i")

h.x = c
n.q = j
n.z = l
n.u = b
k.v = n
k.o = a
k.z = h
j.x = h
l.v = b
l.o = j
l.z = c
b.q = c
b.z = k
b.u = n
m.v = b
m.o = j
m.z = a
a.x = j
c.x = h
i.v = b
i.o = a
i.z = j
assert a.x.x.x.x.x.x.x.x.x.x.txt == "h"