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

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: G = None
        self.s: B = None
        self.t: F = None
        self.z: F = None
        self.txt = txt

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

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

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

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: G = None
        self.s: B = None
        self.t: F = None
        self.z: F = None
        self.txt = txt

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

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

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

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

d.q = f
l.p = k
b.q = g
b.v = f
b.x = f
b.y = l
b.p = e
b.r = k
b.o = n
e.z = d
e.v = d
e.w = g
k.x = n
k.s = l
k.t = g
k.z = g
g.s = d
n.u = e
n.s = e
f.w = l
f.s = l
f.r = e
f.q = n
f.t = g
assert e.z.q.r.v.q.q.s.z.txt == "d"