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

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

class C:
    def __init__(self, txt: str):
        self.q: E = None
        self.o: H = None
        self.r: B = None
        self.x: G = None
        self.p: E = None
        self.y: E = None
        self.z: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.y: A = None
        self.p: I = None
        self.z: H = None
        self.w: H = None
        self.r: B = None
        self.v: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.s: H = None
        self.v: G = None
        self.x: G = None
        self.t: I = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.t: C = None
        self.z: H = None
        self.q: B = None
        self.o: H = None
        self.w: D = None
        self.r: E = None
        self.p: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.t: C = None
        self.z: D = None
        self.s: I = None
        self.v: H = None
        self.y: F = None
        self.txt = txt

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.q: E = None
        self.o: H = None
        self.r: B = None
        self.x: G = None
        self.p: E = None
        self.y: E = None
        self.z: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.y: A = None
        self.p: I = None
        self.z: H = None
        self.w: H = None
        self.r: B = None
        self.v: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.s: H = None
        self.v: G = None
        self.x: G = None
        self.t: I = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.t: C = None
        self.z: H = None
        self.q: B = None
        self.o: H = None
        self.w: D = None
        self.r: E = None
        self.p: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.t: C = None
        self.z: D = None
        self.s: I = None
        self.v: H = None
        self.y: F = None
        self.txt = txt

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

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

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

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