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

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

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

class D:
    def __init__(self, txt: str):
        self.z: A = None
        self.o: G = None
        self.v: E = None
        self.q: A = None
        self.p: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.u: F = None
        self.v: C = None
        self.y: A = None
        self.q: B = None
        self.p: C = None
        self.z: F = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.s: C = None
        self.x: F = None
        self.z: A = None
        self.p: A = None
        self.w: E = None
        self.txt = txt

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.z: A = None
        self.o: G = None
        self.v: E = None
        self.q: A = None
        self.p: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.u: F = None
        self.v: C = None
        self.y: A = None
        self.q: B = None
        self.p: C = None
        self.z: F = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.s: C = None
        self.x: F = None
        self.z: A = None
        self.p: A = None
        self.w: E = None
        self.txt = txt

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

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