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

class B:
    def __init__(self, txt: str):
        self.s: G = None
        self.q: A = None
        self.o: E = None
        self.y: G = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.v: A = None
        self.y: D = None
        self.t: F = None
        self.u: B = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.o: E = None
        self.w: E = None
        self.x: A = None
        self.p: D = None
        self.z: C = None
        self.v: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.y: A = None
        self.txt = txt

h = A("h")
d = B("d")
g = C("g")
n = D("n")
f = E("f")
m = F("m")
i = G("i")
b = G("b")
k = A("k")

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

class B:
    def __init__(self, txt: str):
        self.s: G = None
        self.q: A = None
        self.o: E = None
        self.y: G = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.v: A = None
        self.y: D = None
        self.t: F = None
        self.u: B = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.o: E = None
        self.w: E = None
        self.x: A = None
        self.p: D = None
        self.z: C = None
        self.v: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.y: A = None
        self.txt = txt

h = A("h")
d = B("d")
g = C("g")
n = D("n")
f = E("f")
m = F("m")
i = G("i")
b = G("b")
k = A("k")

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