class A:
    def __init__(self, txt: str):
        self.s: E = None
        self.q: C = None
        self.y: F = None
        self.x: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: B = None
        self.z: D = None
        self.t: D = None
        self.r: C = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.v: E = None
        self.y: H = None
        self.s: B = None
        self.w: B = None
        self.q: H = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.x: D = None
        self.s: D = None
        self.txt = txt

a = A("a")
n = B("n")
c = C("c")
g = D("g")
k = E("k")
f = F("f")
b = G("b")
m = H("m")

a.s = k
a.q = c
a.y = f
a.x = n
n.u = g
n.z = g
n.w = a
n.q = b
n.y = b
c.o = b
c.y = g
c.u = k
c.w = m
c.x = n
c.p = a
c.t = f
g.w = n
k.u = n
k.z = g
k.t = g
k.r = c
f.q = a
f.r = b
b.v = k
b.y = m
b.q = m
b.s = n
b.w = n
m.x = g
m.s = g
assert g.w.u.w.txt == "
class A:
    def __init__(self, txt: str):
        self.s: E = None
        self.q: C = None
        self.y: F = None
        self.x: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: B = None
        self.z: D = None
        self.t: D = None
        self.r: C = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.v: E = None
        self.y: H = None
        self.s: B = None
        self.w: B = None
        self.q: H = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.x: D = None
        self.s: D = None
        self.txt = txt

a = A("a")
n = B("n")
c = C("c")
g = D("g")
k = E("k")
f = F("f")
b = G("b")
m = H("m")

a.s = k
a.q = c
a.y = f
a.x = n
n.u = g
n.z = g
n.w = a
n.q = b
n.y = b
c.o = b
c.y = g
c.u = k
c.w = m
c.x = n
c.p = a
c.t = f
g.w = n
k.u = n
k.z = g
k.t = g
k.r = c
f.q = a
f.r = b
b.v = k
b.y = m
b.q = m
b.s = n
b.w = n
m.x = g
m.s = g
assert g.w.u.w.txt == "n"