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

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

class C:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: D = None
        self.txt = txt

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: D = None
        self.txt = txt

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

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

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