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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.t: C = None
        self.u: C = None
        self.p: E = None
        self.w: E = None
        self.x: D = None
        self.q: C = None
        self.y: A = None
        self.txt = txt

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

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

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.t: C = None
        self.u: C = None
        self.p: E = None
        self.w: E = None
        self.x: D = None
        self.q: C = None
        self.y: A = None
        self.txt = txt

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

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

g.u = k
g.p = f
d.w = h
h.t = d
h.w = b
h.v = n
h.y = f
h.p = i
h.u = a
n.x = i
n.w = g
c.z = h
c.t = i
c.q = b
f.t = h
f.u = h
f.q = h
f.p = a
f.w = c
f.x = n
f.y = g
b.w = a
b.z = f
b.p = h
i.x = n
i.w = g
a.z = h
a.t = i
a.q = b
k.x = n
k.w = g
assert n.x.x.w.txt == "g"