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

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

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

class D:
    def __init__(self, txt: str):
        self.s: H = None
        self.x: A = None
        self.v: E = None
        self.q: G = None
        self.w: G = None
        self.z: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.s: G = None
        self.t: G = None
        self.z: F = None
        self.o: G = None
        self.y: B = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.y: H = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.s: B = None
        self.p: G = None
        self.o: D = None
        self.w: F = None
        self.txt = txt

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.s: H = None
        self.x: A = None
        self.v: E = None
        self.q: G = None
        self.w: G = None
        self.z: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.s: G = None
        self.t: G = None
        self.z: F = None
        self.o: G = None
        self.y: B = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.y: H = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.s: B = None
        self.p: G = None
        self.o: D = None
        self.w: F = None
        self.txt = txt

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

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