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

class B:
    def __init__(self, txt: str):
        self.t: H = None
        self.w: G = None
        self.z: H = None
        self.y: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.v: B = None
        self.z: A = None
        self.p: E = None
        self.t: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.u: F = None
        self.r: B = None
        self.p: C = None
        self.t: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.u: C = None
        self.w: G = None
        self.p: F = None
        self.r: C = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.s: H = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.x: G = None
        self.txt = txt

h = A("h")
g = B("g")
a = C("a")
j = D("j")
n = E("n")
b = F("b")
c = G("c")
k = H("k")
m = H("m")

h.t = n
h.v = j
g.t = k
g.w = c
g.z = m
g.y = b
a.v = g
a.z = h
a.t = h
a.p = n
j.u = b
j.t = b
j.r = g
j.p = a
n.u = a
n.r = a
n.w = c
n.p = b
b.w = a
b.v = a
b.x = a
b.p = c
b.t = c
b.r = j
b.o = m
b.z = h
c.s = m
k.x = c
m.x = c
assert a.p.w.s.x.s.x.s.x.s.txt == "
class A:
    def __init__(self, txt: str):
        self.t: E = None
        self.v: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: H = None
        self.w: G = None
        self.z: H = None
        self.y: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.v: B = None
        self.z: A = None
        self.p: E = None
        self.t: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.u: F = None
        self.r: B = None
        self.p: C = None
        self.t: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.u: C = None
        self.w: G = None
        self.p: F = None
        self.r: C = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.s: H = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.x: G = None
        self.txt = txt

h = A("h")
g = B("g")
a = C("a")
j = D("j")
n = E("n")
b = F("b")
c = G("c")
k = H("k")
m = H("m")

h.t = n
h.v = j
g.t = k
g.w = c
g.z = m
g.y = b
a.v = g
a.z = h
a.t = h
a.p = n
j.u = b
j.t = b
j.r = g
j.p = a
n.u = a
n.r = a
n.w = c
n.p = b
b.w = a
b.v = a
b.x = a
b.p = c
b.t = c
b.r = j
b.o = m
b.z = h
c.s = m
k.x = c
m.x = c
assert a.p.w.s.x.s.x.s.x.s.txt == "m"