class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: A = None
        self.r: G = None
        self.y: A = None
        self.z: D = None
        self.v: G = None
        self.s: D = None
        self.txt = txt

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

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

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

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

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

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

n.r = k
m.p = n
m.y = n
m.r = f
m.v = f
m.z = k
m.s = k
h.u = n
h.s = n
h.z = a
h.q = k
h.v = k
k.u = d
k.v = d
k.p = a
d.o = m
d.r = k
d.q = k
d.y = h
d.t = h
d.p = a
a.y = d
a.v = h
f.o = a
assert h.z.v.z.v.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: A = None
        self.r: G = None
        self.y: A = None
        self.z: D = None
        self.v: G = None
        self.s: D = None
        self.txt = txt

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

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

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

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

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

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

n.r = k
m.p = n
m.y = n
m.r = f
m.v = f
m.z = k
m.s = k
h.u = n
h.s = n
h.z = a
h.q = k
h.v = k
k.u = d
k.v = d
k.p = a
d.o = m
d.r = k
d.q = k
d.y = h
d.t = h
d.p = a
a.y = d
a.v = h
f.o = a
assert h.z.v.z.v.txt == "h"