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

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: B = None
        self.x: C = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.o: C = None
        self.t: A = None
        self.x: B = None
        self.s: B = None
        self.z: B = None
        self.txt = txt

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: B = None
        self.x: C = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.o: C = None
        self.t: A = None
        self.x: B = None
        self.s: B = None
        self.z: B = None
        self.txt = txt

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

a.q = d
a.z = n
a.y = i
d.v = a
k.z = a
k.p = d
k.r = n
k.y = n
k.u = n
k.w = e
n.v = k
n.q = i
i.w = d
i.x = k
m.t = n
m.s = n
m.u = n
m.y = n
e.o = k
e.t = a
e.x = d
e.s = d
e.z = d
assert e.o.p.v.y.w.v.txt == "a"