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

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

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

class D:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

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

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

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

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

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

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

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

f.v = n
f.q = a
a.p = j
a.z = l
j.o = d
j.z = m
n.t = j
d.y = j
d.w = n
d.v = l
d.z = l
b.v = j
b.t = j
b.y = n
b.w = d
m.v = b
l.v = b
assert a.z.v.w.w.t.o.txt == "d"