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

class B:
    def __init__(self, txt: str):
        self.o: D = None
        self.y: D = None
        self.x: G = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.v: I = None
        self.t: A = None
        self.z: H = None
        self.q: I = None
        self.y: F = None
        self.x: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: A = None
        self.t: I = None
        self.u: F = None
        self.s: C = None
        self.w: I = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.x: B = None
        self.t: D = None
        self.o: D = None
        self.y: F = None
        self.u: E = None
        self.q: C = None
        self.r: G = None
        self.s: F = None
        self.z: I = None
        self.txt = txt

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

a = A("a")
d = B("d")
n = C("n")
b = D("b")
g = E("g")
f = F("f")
k = G("k")
h = H("h")
e = I("e")
c = I("c")

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

class B:
    def __init__(self, txt: str):
        self.o: D = None
        self.y: D = None
        self.x: G = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.v: I = None
        self.t: A = None
        self.z: H = None
        self.q: I = None
        self.y: F = None
        self.x: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: A = None
        self.t: I = None
        self.u: F = None
        self.s: C = None
        self.w: I = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.x: B = None
        self.t: D = None
        self.o: D = None
        self.y: F = None
        self.u: E = None
        self.q: C = None
        self.r: G = None
        self.s: F = None
        self.z: I = None
        self.txt = txt

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

a = A("a")
d = B("d")
n = C("n")
b = D("b")
g = E("g")
f = F("f")
k = G("k")
h = H("h")
e = I("e")
c = I("c")

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