class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.r: I = None
        self.u: E = None
        self.z: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: A = None
        self.p: D = None
        self.o: C = None
        self.s: H = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: H = None
        self.t: D = None
        self.p: D = None
        self.q: E = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.w: G = None
        self.s: G = None
        self.r: G = None
        self.v: D = None
        self.p: G = None
        self.u: B = None
        self.y: A = None
        self.x: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.u: H = None
        self.txt = txt

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

class I:
    def __init__(self, txt: str):
        self.v: G = None
        self.u: D = None
        self.q: D = None
        self.w: E = None
        self.x: C = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.y: A = None
        self.p: D = None
        self.o: C = None
        self.s: H = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: H = None
        self.t: D = None
        self.p: D = None
        self.q: E = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.w: G = None
        self.s: G = None
        self.r: G = None
        self.v: D = None
        self.p: G = None
        self.u: B = None
        self.y: A = None
        self.x: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.u: H = None
        self.txt = txt

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

class I:
    def __init__(self, txt: str):
        self.v: G = None
        self.u: D = None
        self.q: D = None
        self.w: E = None
        self.x: C = None
        self.txt = txt

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

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