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

class B:
    def __init__(self, txt: str):
        self.o: F = None
        self.q: H = None
        self.r: F = None
        self.z: D = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.r: C = None
        self.o: A = None
        self.s: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.t: E = None
        self.y: C = None
        self.p: F = None
        self.u: A = None
        self.r: C = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.t: E = None
        self.q: G = None
        self.u: C = None
        self.v: C = None
        self.w: C = None
        self.txt = txt

d = A("d")
f = B("f")
n = C("n")
m = D("m")
g = E("g")
l = F("l")
b = G("b")
j = H("j")

d.w = g
f.o = l
f.r = l
f.q = j
f.z = m
n.t = f
n.z = l
n.s = b
n.v = d
n.w = m
m.q = n
g.s = m
l.r = n
l.o = d
l.s = d
b.t = g
b.y = n
b.r = n
b.p = l
b.u = d
j.t = g
j.q = b
j.u = n
j.v = n
j.w = n
assert m.q.w.q.txt == "
class A:
    def __init__(self, txt: str):
        self.w: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: F = None
        self.q: H = None
        self.r: F = None
        self.z: D = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.r: C = None
        self.o: A = None
        self.s: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.t: E = None
        self.y: C = None
        self.p: F = None
        self.u: A = None
        self.r: C = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.t: E = None
        self.q: G = None
        self.u: C = None
        self.v: C = None
        self.w: C = None
        self.txt = txt

d = A("d")
f = B("f")
n = C("n")
m = D("m")
g = E("g")
l = F("l")
b = G("b")
j = H("j")

d.w = g
f.o = l
f.r = l
f.q = j
f.z = m
n.t = f
n.z = l
n.s = b
n.v = d
n.w = m
m.q = n
g.s = m
l.r = n
l.o = d
l.s = d
b.t = g
b.y = n
b.r = n
b.p = l
b.u = d
j.t = g
j.q = b
j.u = n
j.v = n
j.w = n
assert m.q.w.q.txt == "n"