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

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

class C:
    def __init__(self, txt: str):
        self.q: E = None
        self.z: B = None
        self.s: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.u: H = None
        self.s: G = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.q: B = None
        self.txt = txt

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

n = A("n")
f = B("f")
e = C("e")
d = D("d")
h = E("h")
b = F("b")
c = G("c")
j = H("j")

n.w = d
n.u = c
n.y = c
n.r = c
n.q = c
n.z = b
f.u = e
f.p = e
f.w = d
f.s = c
e.q = h
e.z = f
e.s = f
d.x = n
d.o = f
d.r = e
d.y = h
d.v = b
d.p = j
h.u = j
h.s = c
b.r = n
b.v = d
b.u = j
c.q = f
j.q = n
j.w = n
j.x = e
j.u = e
j.r = f
j.y = c
j.z = d
assert j.r.s.q.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.u: G = None
        self.y: G = None
        self.r: G = None
        self.q: G = None
        self.z: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.q: E = None
        self.z: B = None
        self.s: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.u: H = None
        self.s: G = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.q: B = None
        self.txt = txt

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

n = A("n")
f = B("f")
e = C("e")
d = D("d")
h = E("h")
b = F("b")
c = G("c")
j = H("j")

n.w = d
n.u = c
n.y = c
n.r = c
n.q = c
n.z = b
f.u = e
f.p = e
f.w = d
f.s = c
e.q = h
e.z = f
e.s = f
d.x = n
d.o = f
d.r = e
d.y = h
d.v = b
d.p = j
h.u = j
h.s = c
b.r = n
b.v = d
b.u = j
c.q = f
j.q = n
j.w = n
j.x = e
j.u = e
j.r = f
j.y = c
j.z = d
assert j.r.s.q.txt == "f"