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

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

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

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

class E:
    def __init__(self, txt: str):
        self.s: H = None
        self.o: D = None
        self.x: A = None
        self.r: H = None
        self.txt = txt

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

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

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

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

e.q = n
l.o = n
l.s = n
f.r = l
f.x = b
f.w = g
f.z = k
a.o = e
n.s = b
n.r = b
n.o = a
n.x = e
k.q = g
i.v = k
i.q = k
i.w = a
b.z = e
b.v = e
g.q = k
h.v = k
h.w = a
h.q = g
assert k.q.q.q.q.q.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.s: H = None
        self.o: D = None
        self.x: A = None
        self.r: H = None
        self.txt = txt

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

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

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

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

e.q = n
l.o = n
l.s = n
f.r = l
f.x = b
f.w = g
f.z = k
a.o = e
n.s = b
n.r = b
n.o = a
n.x = e
k.q = g
i.v = k
i.q = k
i.w = a
b.z = e
b.v = e
g.q = k
h.v = k
h.w = a
h.q = g
assert k.q.q.q.q.q.q.q.txt == "g"