class A:
    def __init__(self, txt: str):
        self.z: G = None
        self.u: F = None
        self.r: G = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.q: B = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.x: E = None
        self.z: H = None
        self.u: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.w: H = None
        self.p: C = None
        self.v: H = None
        self.z: A = None
        self.q: A = None
        self.txt = txt

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.q: B = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.x: E = None
        self.z: H = None
        self.u: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.w: H = None
        self.p: C = None
        self.v: H = None
        self.z: A = None
        self.q: A = None
        self.txt = txt

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

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

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