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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.p: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.y: C = None
        self.x: C = None
        self.r: D = None
        self.o: F = None
        self.u: A = None
        self.s: A = None
        self.w: D = None
        self.txt = txt

n = A("n")
h = B("h")
a = C("a")
i = D("i")
k = E("k")
l = F("l")
m = G("m")

n.v = h
h.o = k
h.v = l
h.s = l
a.w = i
a.v = m
i.y = m
i.u = a
k.p = n
k.w = n
k.o = i
k.s = h
k.r = h
k.v = h
k.u = l
l.p = m
m.y = a
m.x = a
m.r = i
m.w = i
m.o = l
m.u = n
m.s = n
assert a.w.y.s.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.p: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.y: C = None
        self.x: C = None
        self.r: D = None
        self.o: F = None
        self.u: A = None
        self.s: A = None
        self.w: D = None
        self.txt = txt

n = A("n")
h = B("h")
a = C("a")
i = D("i")
k = E("k")
l = F("l")
m = G("m")

n.v = h
h.o = k
h.v = l
h.s = l
a.w = i
a.v = m
i.y = m
i.u = a
k.p = n
k.w = n
k.o = i
k.s = h
k.r = h
k.v = h
k.u = l
l.p = m
m.y = a
m.x = a
m.r = i
m.w = i
m.o = l
m.u = n
m.s = n
assert a.w.y.s.v.txt == "h"