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

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

class C:
    def __init__(self, txt: str):
        self.q: B = None
        self.s: H = None
        self.z: B = None
        self.o: G = None
        self.t: G = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.w: E = None
        self.txt = txt

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

a = A("a")
i = B("i")
n = C("n")
j = D("j")
h = E("h")
k = F("k")
c = G("c")
g = H("g")
d = F("d")

a.s = j
a.q = h
a.p = h
i.p = c
n.q = i
n.z = i
n.s = g
n.o = c
n.t = c
j.q = h
h.o = k
h.r = g
k.q = d
k.o = d
k.x = d
k.v = j
k.r = j
k.y = g
c.w = h
g.x = a
d.q = k
d.o = k
d.x = k
d.v = j
d.r = j
d.y = g
assert j.q.o.v.q.r.x.s.q.o.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.q: E = None
        self.p: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.q: B = None
        self.s: H = None
        self.z: B = None
        self.o: G = None
        self.t: G = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.w: E = None
        self.txt = txt

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

a = A("a")
i = B("i")
n = C("n")
j = D("j")
h = E("h")
k = F("k")
c = G("c")
g = H("g")
d = F("d")

a.s = j
a.q = h
a.p = h
i.p = c
n.q = i
n.z = i
n.s = g
n.o = c
n.t = c
j.q = h
h.o = k
h.r = g
k.q = d
k.o = d
k.x = d
k.v = j
k.r = j
k.y = g
c.w = h
g.x = a
d.q = k
d.o = k
d.x = k
d.v = j
d.r = j
d.y = g
assert j.q.o.v.q.r.x.s.q.o.txt == "k"