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

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

class C:
    def __init__(self, txt: str):
        self.r: G = None
        self.v: H = None
        self.w: A = None
        self.q: E = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.s: A = None
        self.o: F = None
        self.z: E = None
        self.u: A = None
        self.txt = txt

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

f = A("f")
c = B("c")
d = C("d")
b = D("b")
i = E("i")
m = F("m")
l = G("l")
g = H("g")
e = F("e")
a = B("a")

f.p = g
f.o = b
f.y = b
f.s = i
f.q = i
f.r = i
f.z = c
c.z = g
d.r = l
d.v = g
d.w = f
d.q = i
b.u = g
b.p = g
b.y = a
b.s = m
b.q = d
i.z = g
m.z = a
l.s = f
l.u = f
l.o = e
l.z = i
g.w = i
e.z = a
a.z = g
assert i.z.w.z.w.z.w.z.txt == "
class A:
    def __init__(self, txt: str):
        self.p: H = None
        self.o: D = None
        self.s: E = None
        self.q: E = None
        self.y: D = None
        self.z: B = None
        self.r: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.r: G = None
        self.v: H = None
        self.w: A = None
        self.q: E = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.s: A = None
        self.o: F = None
        self.z: E = None
        self.u: A = None
        self.txt = txt

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

f = A("f")
c = B("c")
d = C("d")
b = D("b")
i = E("i")
m = F("m")
l = G("l")
g = H("g")
e = F("e")
a = B("a")

f.p = g
f.o = b
f.y = b
f.s = i
f.q = i
f.r = i
f.z = c
c.z = g
d.r = l
d.v = g
d.w = f
d.q = i
b.u = g
b.p = g
b.y = a
b.s = m
b.q = d
i.z = g
m.z = a
l.s = f
l.u = f
l.o = e
l.z = i
g.w = i
e.z = a
a.z = g
assert i.z.w.z.w.z.w.z.txt == "g"