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

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

class C:
    def __init__(self, txt: str):
        self.w: A = None
        self.v: A = None
        self.o: G = None
        self.y: F = None
        self.t: D = None
        self.q: D = None
        self.r: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: C = None
        self.o: F = None
        self.t: A = None
        self.x: C = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.y: A = None
        self.o: E = None
        self.t: A = None
        self.q: C = None
        self.v: G = None
        self.w: A = None
        self.x: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.p: H = None
        self.t: B = None
        self.o: E = None
        self.s: D = None
        self.x: D = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.r: G = None
        self.w: F = None
        self.y: A = None
        self.x: B = None
        self.txt = txt

m = A("m")
h = B("h")
b = C("b")
f = D("f")
c = E("c")
e = F("e")
k = G("k")
a = H("a")

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

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

class C:
    def __init__(self, txt: str):
        self.w: A = None
        self.v: A = None
        self.o: G = None
        self.y: F = None
        self.t: D = None
        self.q: D = None
        self.r: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: C = None
        self.o: F = None
        self.t: A = None
        self.x: C = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.y: A = None
        self.o: E = None
        self.t: A = None
        self.q: C = None
        self.v: G = None
        self.w: A = None
        self.x: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.p: H = None
        self.t: B = None
        self.o: E = None
        self.s: D = None
        self.x: D = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.r: G = None
        self.w: F = None
        self.y: A = None
        self.x: B = None
        self.txt = txt

m = A("m")
h = B("h")
b = C("b")
f = D("f")
c = E("c")
e = F("e")
k = G("k")
a = H("a")

m.v = b
m.q = c
m.w = f
m.r = a
h.z = a
h.q = a
h.s = c
h.t = m
h.o = m
h.r = e
b.w = m
b.v = m
b.o = k
b.y = e
b.r = e
b.t = f
b.q = f
f.r = b
f.x = b
f.o = e
f.t = m
c.u = h
c.s = k
e.y = m
e.t = m
e.w = m
e.o = c
e.q = b
e.v = k
e.x = h
k.p = a
k.t = h
k.o = c
k.s = f
k.x = f
a.r = k
a.w = e
a.y = m
a.x = h
assert a.r.p.w.x.txt == "h"