class A:
    def __init__(self, txt: str):
        self.q: I = None
        self.t: I = None
        self.x: G = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.z: E = None
        self.r: H = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: G = None
        self.z: F = None
        self.u: A = None
        self.x: C = None
        self.y: D = None
        self.o: I = None
        self.p: A = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.v: I = None
        self.x: D = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.o: D = None
        self.t: B = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.w: C = None
        self.u: A = None
        self.txt = txt

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.z: E = None
        self.r: H = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: G = None
        self.z: F = None
        self.u: A = None
        self.x: C = None
        self.y: D = None
        self.o: I = None
        self.p: A = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.v: I = None
        self.x: D = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.o: D = None
        self.t: B = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.w: C = None
        self.u: A = None
        self.txt = txt

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

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