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

class B:
    def __init__(self, txt: str):
        self.t: F = None
        self.w: A = None
        self.y: F = None
        self.q: G = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.s: B = None
        self.u: B = None
        self.w: C = None
        self.r: A = None
        self.v: C = None
        self.z: G = None
        self.x: F = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.q: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.t: A = None
        self.r: B = None
        self.txt = txt

a = A("a")
n = B("n")
d = C("d")
e = D("e")
b = E("b")
g = F("g")
k = G("k")
c = D("c")

a.w = e
a.z = k
a.s = g
n.t = g
n.y = g
n.w = a
n.q = k
d.t = b
e.s = n
e.u = n
e.w = d
e.v = d
e.r = a
e.z = k
e.x = g
b.u = n
g.q = a
k.t = a
k.r = n
c.s = n
c.u = n
c.w = d
c.v = d
c.r = a
c.z = k
c.x = g
assert c.z.r.w.w.z.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.z: G = None
        self.s: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: F = None
        self.w: A = None
        self.y: F = None
        self.q: G = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.s: B = None
        self.u: B = None
        self.w: C = None
        self.r: A = None
        self.v: C = None
        self.z: G = None
        self.x: F = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.q: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.t: A = None
        self.r: B = None
        self.txt = txt

a = A("a")
n = B("n")
d = C("d")
e = D("e")
b = E("b")
g = F("g")
k = G("k")
c = D("c")

a.w = e
a.z = k
a.s = g
n.t = g
n.y = g
n.w = a
n.q = k
d.t = b
e.s = n
e.u = n
e.w = d
e.v = d
e.r = a
e.z = k
e.x = g
b.u = n
g.q = a
k.t = a
k.r = n
c.s = n
c.u = n
c.w = d
c.v = d
c.r = a
c.z = k
c.x = g
assert c.z.r.w.w.z.txt == "k"