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

class B:
    def __init__(self, txt: str):
        self.r: A = None
        self.v: C = None
        self.o: E = None
        self.u: G = None
        self.t: A = None
        self.z: H = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.u: F = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.v: H = None
        self.z: E = None
        self.r: E = None
        self.p: A = None
        self.s: H = None
        self.o: H = None
        self.w: G = None
        self.x: H = None
        self.txt = txt

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

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

i = A("i")
j = B("j")
l = C("l")
n = D("n")
m = E("m")
e = F("e")
g = G("g")
k = H("k")

i.w = k
j.r = i
j.t = i
j.v = l
j.o = m
j.u = g
j.z = k
l.p = m
l.r = k
l.o = k
l.z = n
l.u = n
n.u = e
m.w = g
e.v = k
e.s = k
e.o = k
e.x = k
e.z = m
e.r = m
e.p = i
e.w = g
g.u = m
g.r = n
k.v = m
k.z = m
k.t = i
k.u = e
k.p = e
k.s = g
assert m.w.u.w.u.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: H = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: A = None
        self.v: C = None
        self.o: E = None
        self.u: G = None
        self.t: A = None
        self.z: H = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.u: F = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.v: H = None
        self.z: E = None
        self.r: E = None
        self.p: A = None
        self.s: H = None
        self.o: H = None
        self.w: G = None
        self.x: H = None
        self.txt = txt

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

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

i = A("i")
j = B("j")
l = C("l")
n = D("n")
m = E("m")
e = F("e")
g = G("g")
k = H("k")

i.w = k
j.r = i
j.t = i
j.v = l
j.o = m
j.u = g
j.z = k
l.p = m
l.r = k
l.o = k
l.z = n
l.u = n
n.u = e
m.w = g
e.v = k
e.s = k
e.o = k
e.x = k
e.z = m
e.r = m
e.p = i
e.w = g
g.u = m
g.r = n
k.v = m
k.z = m
k.t = i
k.u = e
k.p = e
k.s = g
assert m.w.u.w.u.w.txt == "g"