class A:
    def __init__(self, txt: str):
        self.q: I = None
        self.o: D = None
        self.r: D = None
        self.v: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.o: I = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.v: C = None
        self.o: F = None
        self.s: F = None
        self.u: F = None
        self.q: C = None
        self.r: B = None
        self.txt = txt

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

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

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

class I:
    def __init__(self, txt: str):
        self.s: E = None
        self.t: E = None
        self.z: A = None
        self.txt = txt

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.o: I = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.v: C = None
        self.o: F = None
        self.s: F = None
        self.u: F = None
        self.q: C = None
        self.r: B = None
        self.txt = txt

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

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

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

class I:
    def __init__(self, txt: str):
        self.s: E = None
        self.t: E = None
        self.z: A = None
        self.txt = txt

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

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