class A:
    def __init__(self, txt: str):
        self.p: F = None
        self.v: C = None
        self.u: F = None
        self.z: F = None
        self.o: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: E = None
        self.x: A = None
        self.v: D = None
        self.w: E = None
        self.p: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: D = None
        self.s: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: A = None
        self.w: F = None
        self.p: F = None
        self.q: A = None
        self.x: B = None
        self.r: C = None
        self.s: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.v: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.s: A = None
        self.z: C = None
        self.u: D = None
        self.p: A = None
        self.q: B = None
        self.w: G = None
        self.r: G = None
        self.txt = txt

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

h = A("h")
f = B("f")
g = C("g")
n = D("n")
m = E("m")
l = F("l")
j = G("j")

h.p = l
h.u = l
h.z = l
h.v = g
h.o = n
f.o = m
f.w = m
f.x = h
f.p = h
f.v = n
g.q = n
g.s = j
n.v = h
n.q = h
n.w = l
n.p = l
n.x = f
n.r = g
n.s = j
m.v = l
l.s = h
l.p = h
l.z = g
l.u = n
l.q = f
l.w = j
l.r = j
j.z = m
j.y = m
j.p = g
j.t = g
j.u = f
j.r = l
assert m.v.w.t.q.x.v.txt == "
class A:
    def __init__(self, txt: str):
        self.p: F = None
        self.v: C = None
        self.u: F = None
        self.z: F = None
        self.o: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: E = None
        self.x: A = None
        self.v: D = None
        self.w: E = None
        self.p: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: D = None
        self.s: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: A = None
        self.w: F = None
        self.p: F = None
        self.q: A = None
        self.x: B = None
        self.r: C = None
        self.s: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.v: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.s: A = None
        self.z: C = None
        self.u: D = None
        self.p: A = None
        self.q: B = None
        self.w: G = None
        self.r: G = None
        self.txt = txt

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

h = A("h")
f = B("f")
g = C("g")
n = D("n")
m = E("m")
l = F("l")
j = G("j")

h.p = l
h.u = l
h.z = l
h.v = g
h.o = n
f.o = m
f.w = m
f.x = h
f.p = h
f.v = n
g.q = n
g.s = j
n.v = h
n.q = h
n.w = l
n.p = l
n.x = f
n.r = g
n.s = j
m.v = l
l.s = h
l.p = h
l.z = g
l.u = n
l.q = f
l.w = j
l.r = j
j.z = m
j.y = m
j.p = g
j.t = g
j.u = f
j.r = l
assert m.v.w.t.q.x.v.txt == "n"