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

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

class C:
    def __init__(self, txt: str):
        self.z: D = None
        self.x: I = None
        self.t: I = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.s: C = None
        self.y: H = None
        self.z: E = None
        self.txt = txt

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

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.z: D = None
        self.x: I = None
        self.t: I = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.s: C = None
        self.y: H = None
        self.z: E = None
        self.txt = txt

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

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

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

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

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