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

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

class C:
    def __init__(self, txt: str):
        self.o: G = None
        self.q: B = None
        self.r: F = None
        self.w: B = None
        self.s: B = None
        self.u: H = None
        self.x: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.r: C = None
        self.z: H = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.t: C = None
        self.p: C = None
        self.y: C = None
        self.w: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.r: C = None
        self.w: D = None
        self.u: F = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.p: C = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.o: G = None
        self.q: B = None
        self.r: F = None
        self.w: B = None
        self.s: B = None
        self.u: H = None
        self.x: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.r: C = None
        self.z: H = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.t: C = None
        self.p: C = None
        self.y: C = None
        self.w: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.r: C = None
        self.w: D = None
        self.u: F = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.p: C = None
        self.txt = txt

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

a.q = f
i.u = k
i.s = n
n.o = b
n.q = i
n.w = i
n.s = i
n.r = k
n.u = j
n.x = l
l.q = n
l.y = j
l.t = j
f.r = n
f.z = j
k.t = n
k.p = n
k.y = n
k.w = a
b.r = n
b.w = l
b.u = k
j.p = n
h.r = n
h.w = l
h.u = k
assert k.p.w.s.x.t.p.r.txt == "k"