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

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

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

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

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

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

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

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

f.z = m
f.q = m
f.y = m
f.p = m
f.t = h
f.w = b
f.r = j
j.v = n
b.z = m
b.q = a
m.v = h
m.y = j
a.y = b
h.v = d
h.s = a
h.z = f
d.v = m
d.y = b
n.v = m
n.y = b
assert d.v.y.v.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.q: D = None
        self.t: F = None
        self.w: C = None
        self.y: D = None
        self.r: B = None
        self.p: D = None
        self.txt = txt

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

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

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

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

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

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

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

f.z = m
f.q = m
f.y = m
f.p = m
f.t = h
f.w = b
f.r = j
j.v = n
b.z = m
b.q = a
m.v = h
m.y = j
a.y = b
h.v = d
h.s = a
h.z = f
d.v = m
d.y = b
n.v = m
n.y = b
assert d.v.y.v.v.v.txt == "h"