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

class B:
    def __init__(self, txt: str):
        self.v: C = None
        self.t: C = None
        self.w: C = None
        self.p: G = None
        self.r: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: B = None
        self.z: E = None
        self.r: H = None
        self.q: F = None
        self.w: G = None
        self.y: A = None
        self.o: D = None
        self.t: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.y: H = None
        self.u: C = None
        self.q: F = None
        self.s: E = None
        self.o: A = None
        self.x: F = None
        self.p: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.u: D = None
        self.txt = txt

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.v: C = None
        self.t: C = None
        self.w: C = None
        self.p: G = None
        self.r: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: B = None
        self.z: E = None
        self.r: H = None
        self.q: F = None
        self.w: G = None
        self.y: A = None
        self.o: D = None
        self.t: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.y: H = None
        self.u: C = None
        self.q: F = None
        self.s: E = None
        self.o: A = None
        self.x: F = None
        self.p: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.u: D = None
        self.txt = txt

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

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

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

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

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