class A:
    def __init__(self, txt: str):
        self.z: H = None
        self.r: G = None
        self.v: C = None
        self.p: G = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.z: D = None
        self.x: E = None
        self.t: H = None
        self.v: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: F = None
        self.w: C = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.u: E = None
        self.t: G = None
        self.q: C = None
        self.s: F = None
        self.y: G = None
        self.w: E = None
        self.txt = txt

k = A("k")
j = B("j")
m = C("m")
d = D("d")
g = E("g")
c = F("c")
b = G("b")
e = H("e")

k.z = e
k.r = b
k.p = b
k.v = m
j.s = k
j.y = k
m.z = d
m.x = g
m.t = e
m.v = k
d.v = c
d.w = m
g.o = k
g.z = j
g.r = c
g.t = e
g.x = e
g.s = b
c.q = k
c.s = g
c.v = m
c.o = b
b.o = m
e.u = g
e.w = g
e.t = b
e.y = b
e.q = m
e.s = c
assert k.p.o.z.w.txt == "
class A:
    def __init__(self, txt: str):
        self.z: H = None
        self.r: G = None
        self.v: C = None
        self.p: G = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.z: D = None
        self.x: E = None
        self.t: H = None
        self.v: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: F = None
        self.w: C = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.u: E = None
        self.t: G = None
        self.q: C = None
        self.s: F = None
        self.y: G = None
        self.w: E = None
        self.txt = txt

k = A("k")
j = B("j")
m = C("m")
d = D("d")
g = E("g")
c = F("c")
b = G("b")
e = H("e")

k.z = e
k.r = b
k.p = b
k.v = m
j.s = k
j.y = k
m.z = d
m.x = g
m.t = e
m.v = k
d.v = c
d.w = m
g.o = k
g.z = j
g.r = c
g.t = e
g.x = e
g.s = b
c.q = k
c.s = g
c.v = m
c.o = b
b.o = m
e.u = g
e.w = g
e.t = b
e.y = b
e.q = m
e.s = c
assert k.p.o.z.w.txt == "m"